How I can force menu item to show under overflow icon. I am providing app support from api level 8 and above. for now it is showing as actionview . My menuLayout is as follows.
//main.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/action_menu_setting"
android:title="@string/menuItemSetting"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_signout"
android:title="@string/menuItemLogout"
app:showAsAction="ifRoom"/>
</menu>
in Java class
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return super.onCreateOptionsMenu(menu);
}
I have tried with other options of showAsAction
but none of them worked. Please suggest me how I can show above two menu itme under overflow
icon(when i click on over these two will appearer as actionlist.)
Could you post java code ? Do you have code below in your activity ?
Edit : I alway use code like this(when i click action_settings it will show action list contains setting and bar, i think just replace android:title="@string/action_settings" with android:icon)
Hope it helps
layout for custom action bar
You can call below function in onCreate and define button in this function as I have defined appName text view and its OnClick event
Hope this will be useful for you :) But clicking physical button of device will not trigger this button you have to look for it, as I don't have any idea about it