How can I change the background color of a menu (inflater)?
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
if (v.getId() == R.id.hostList) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.host_menu, menu);
}
}
and the menu is:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/test1"
android:title="@string/test1">
</item>
<item
android:id="@+id/test2"
android:title="@string/test2">
</item>
</menu>
I tried a lot of things, but I can just change the colors of texts (or background of text) using "TextAppearanceSpan".. but I need to change all the menu' background.