Options menu in android applications can be customized to set the background or change the text appearance. The background and text color in the menu couldn’t be changed using themes and styles. The android source code (datareslayouticon_menu_item_layout.xml)uses a custom item of class “com.android.internal.view.menu.IconMenuItem”View for the menu layout. We can make changes in the above class to customize the menu. To achieve the same, use LayoutInflater factory class and set the background and text color for the view.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.my_menu, menu);

getLayoutInflater().setFactory(new Factory() {
@Override
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() {

// set the background drawable
view .setBackgroundResource(R.drawable.my_ac_menu_background);

// set the text color
((TextView) view).setTextColor(Color.WHITE);
}
});
return view;
} catch (InflateException e) {
} catch (ClassNotFoundException e) {
}
}
return null;
}
});
return super.onCreateOptionsMenu(menu);
}

Buy cheap Anacin