android option menu background change android

protected void optionsMenuSetMenuBackground(){
        getLayoutInflater().setFactory( new Factory() {
   @Override
   public View onCreateView(String name, Context arg1,
     AttributeSet attrs) {
    // TODO Auto-generated method stub
    if ( name.equalsIgnoreCase( "com.android.internal.view.menu.IconMenuItemView" ) ) {
                    try { 

                        LayoutInflater f = getLayoutInflater();
                        final View view = f.createView( name, null, attrs );
                                              new Handler().post( new Runnable() {
                            public void run () {
                                view.setBackgroundColor(Color.argb(255, 0, 20, 60));
                            }
                        } );
                        return view;
                    }
                    catch ( InflateException e ) {}
                    catch ( ClassNotFoundException e ) {}
                }
                return null;
   }
        });
 }

 

 

이 메소드로 색깔은 바꿀수있긴하다.... 


덧글

댓글 입력 영역