I created an options menu with an icon that I made myself (24px x 24px), but it does not appear.
The code in my xml (located in res / menu) is as follows:
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/menu_insert" android:icon="@drawable/menu_add" android:title="@string/menu_insert" /> </menu>
The menu is created in the Activity.java file, as indicated in the documentation:
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater mi = getMenuInflater(); mi.inflate(R.menu.list_menu, menu); return true; }
PS The title of the element is located all the way to the left, and I can not find anywhere in the documentation how to center it (apparently, android: gravity does not work there)
thanks
source share