android - Two overflow menus visible -
i have 2 below menu items:
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".mainactivity"> <item android:id="@+id/action_search" android:title="@string/action_search" android:icon="@drawable/ic_search_white_24dp" yourapp:showasaction="always|collapseactionview" yourapp:actionviewclass="android.support.v7.widget.searchview" /> <item android:id="@+id/action_about" android:title="@string/action_about" android:orderincategory="100" yourapp:showasaction="never" /> </menu>
overflow menu style:
<style name="apptheme" parent="theme.appcompat.light.noactionbar"> <item name="actionoverflowmenustyle">@style/optionsmenu</item> </style> <style name="optionsmenu" parent="widget.appcompat.popupmenu.overflow"> <item name="android:popupbackground">@color/colorprimary</item> </style>
when application run, 2 overflow menus visible: 1 upon clicking '3 dots' in toolbar (styled above, pops in upper right corner) , other when menu button clicked (default style, pops in bottom of screen).
how show 1 of menus - preferably 1 pops in upper right corner?
i facing same issue yours. , resolve below code:
@override public boolean onkeyup(int keycode, keyevent event) { if (keycode == keyevent.keycode_menu) { toolbar.showoverflowmenu(); return true; } return super.onkeyup(keycode, event); }
Comments
Post a Comment