I want to set background image for menu buttons. I can see the image on emulator, but when I run the app on device it does not show any background image, but only transparent white background. I have set the background like this
受保护空白
getLayoutInflater().setFactory( new Factory() {
public View onCreateView(String name, Context context, AttributeSet attrs) {
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.setBackgroundResource( R.drawable.menubuttons_bg );
}
iii);
return view;
}
catch ( InflateException e ) {}
catch ( ClassNotFoundException e ) {iii
iii
return null;
}});
iii