I'm trying to create a spinner item in my menu bar via XML. My code is as follows,
res/layout/spinner_filter_results.xml
<Spinner xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/results_filters"/>
res/menu/menu_results.xml
<?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">
<!-- Spinner not showing up -->
<item
android:id="@+id/menuFilter"
android:title="@string/filter"
android:actionLayout="@layout/spinner_filter_results"
app:showAsAction="always">
</item>
<item
android:id="@+id/iconHamburger"
android:icon="@drawable/ic_menu_white_24dp"
app:showAsAction="ifRoom|withText"
android:title="@string/options">
<menu>
<item
android:id="@+id/menu_settings"
android:title="@string/settings"
android:onClick="onMenuItemClick"></item>
<item
android:id="@+id/menu_logout"
android:title="@string/log_out"
android:onClick="onMenuItemClick"></item>
</menu>
</item>
</menu>
This shows up fine in the Android Studio designer, this is exactly what I want:
But on my phone it doesn't show up.
I've looked to other Stack Overflow posts such as this one, but I still can't figure out why the above code doesn't work. Does anyone have any insight as to why it doesn't show up on my phone? Is this just a problem of my phone?(LG G4, Android 6.0, SDK 23)
EDIT 1: I turned on Show Layout Bounds on my phone. I see that the Menu item for the Spinner exists but it seems to be empty?