Reputation: 13165
Can anybody tell me how to change the display position of the action bar overflow menu in android? In my application there is an image button. If the user clicks the image button I want to display the action bar overflow menu below the image button. Is it possible to do?
Thanks
Upvotes: 0
Views: 3566
Reputation: 8939
You can define action bar Overflow menu
like say your_menu.xml in menu
folder.
and do changes in Manifest
file as well. Click Split Action Bar
<activity uiOptions="splitActionBarWhenNarrow" ... >// for API >=11
<meta-data android:name="android.support.UI_OPTIONS" // support for >=8
android:value="splitActionBarWhenNarrow" />
</activity>
And Menu is like below
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/button" android:title="@string/menu_option" android:icon="@drawable/icon" android:showAsAction="always">
<menu>
<item android:id="@+id/action1" android:title="@string/menu_action1" />
<item android:id="@+id/action2" android:title="@string/menu_action2" />
<item android:id="@+id/action3" android:title="@string/menu_action3" />
<item android:id="@+id/action4" android:title="@string/menu_action4" />
<item android:id="@+id/action5" android:title="@string/menu_action5"/>
</menu>
</item>
</menu>
If will behave like if there is space in action bar
, when you will click on ImageButton
then Overflow menu will below that button.
If there is no space in the Action bar
then, it will show in bottom. And if you will click on ImageButton
then Overflow menu will open on the top of Button.
Upvotes: 1