Actionbar menu not showing for android 4.X, but works on 2.2 -
i'm trying inflate new menu in fragment. code works android 2.2 not 4.x... i'm using actionbar compat. logcat outputs "create menu" log.
here code:
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); sethasoptionsmenu(true); } //(...) @override public void oncreateoptionsmenu(menu menu, menuinflater inflater) { log.i("create menu"); menu.clear(); inflater.inflate(r.menu.textarea_actions, menu); super.oncreateoptionsmenu(menu,inflater); }
and menu xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:dealer="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_save" android:icon="@drawable/action_check" dealer:showasaction="always" android:title="submit"/> </menu>
this code works in android 2.2. here print:
in android 4.x button not shown, if select text copy/paste, android replace action bar system actionbar of copy/paste/cut. when deselect text actionbar of app reappears, time button...
here prints:
this strange problem, tried refresh action bar, unsuccessful...
well continued developing , problem seems ok (not solved, worked around).
this part of app based on 1 activity , switch fragments. added menus in firsts fragments , menu appears on fragment...
Comments
Post a Comment