aacanakin aacanakin - 2 months ago 36
Android Question

app:showAsAction ifRoom is not working on appcompat action bar

I have an action bar with the following menu items;

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.blah.blah.app.ClientActivity" >

<item android:id="@+id/action_search"
android:icon="@drawable/search"
android:title="@string/action_search"
android:orderInCategory="1"
app:showAsAction="ifRoom|withText"/>

<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="5"
app:showAsAction="ifRoom"/>

<item android:id="@+id/action_waiter"
android:title="@string/action_waiter"
android:orderInCategory="6"
app:showAsAction="ifRoom"/>

<item android:id="@+id/action_cleantable"
android:title="@string/action_cleantable"
android:orderInCategory="7"
app:showAsAction="ifRoom"/>

<item android:id="@+id/action_suggest"
android:title="@string/action_suggest"
android:orderInCategory="8"
app:showAsAction="ifRoom"/>

<item android:id="@+id/action_waiterlogin"
android:title="@string/action_waiterlogin"
android:orderInCategory="9"
app:showAsAction="ifRoom"/>
</menu>


The problem is my search button doesn't show on action bar but the text is showed in overflow. There's plenty of room in my action bar

I'm using
"@style/Theme.AppCompat.Light"


Can anyone help me ?

tpA tpA
Answer

Please Try to use android:showAsAction="ifRoom|withText" instead of app:showAsAction="ifRoom|withText"