You can customize the options menu, including:
To change the background to a border or gradient, you need to create a resource folder in res called drawable , and inside it create an XML or gradient XML border.
All this can be done programmatically, as shown below:
public class CustomMenu extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public boolean onCreateOptionsMenu(android.view.Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.cool_menu, menu); getLayoutInflater().setFactory(new Factory() { public View onCreateView(String name, Context context, AttributeSet attrs) { if (name.equalsIgnoreCase( "com.android.internal.view.menu.IconMenuItemView")) { try { LayoutInflater li = LayoutInflater.from(context); final View view = li.createView(name, null, attrs); new Handler().post(new Runnable() { public void run() {
Do not forget to create a folder with the name menu in the res folder, and inside the menu folder, create XML for your menu (for example, cool_menu.xml ), for example:
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:title="about"android:id="@+id/AboutUs" /> <item android:title="Prefs" android:id="@+id/preferences" /> <item android:title="Exit" android:id="@+id/exit" /> </menu>
Then the output will be something like this:

Android Stack Jul 07 '12 at 16:10 2012-07-07 16:10
source share