I just tried to add an option menu to my app, but it's not showing any content.
Here's my XML:
<menu xmlns:android="https://schemas.android.com/apk/res/android">
<item android:id="@+id/item1"
android:title="Test1"/>
<item android:id="@+id/item2"
android:title="Test2"/>
<item android:id="@+id/item3"
android:title="Test3"
android:icon="@drawable/icon"/>
</menu>
Path is res/menu/menu.xml
That's my code in the main activity:
public boolean onCreateOptionsMenu(Menu menu){
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
I can open the menu and it shows three white squares. I can click on them and the menu closes.
I tried changing the text color via android:textColor
and the background color via android:color
, but this didn't work either.
Edit: It's working if I use menu.add(...)
, but I actually do prefer using the XML resource...