android - Contextual Action Mode AppCompatActivity not show -
i have activity extending appcompatactivity, , wish set contextual action bar on it. here oncreate method
toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); mainactivity.this.startsupportactionmode(new actionbarcallback());
my actionbarcallback extend android.support.v7.view.actionmode , declared that
@override public boolean oncreateactionmode(actionmode mode, menu menu) { mode.getmenuinflater().inflate(r.menu.contextual_menu, menu); return false; //here error }
the theme set on manifest
<style name="apptheme.noactionbar"> <item name="windowactionbar">false</item> <item name="windownotitle">true</item> <item name="windowactionmodeoverlay">true</item> </style>
manifest
<application android:name=".application" android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme" > </application>
activity
<activity android:name=".mainactivity" android:label="@string/title_activity_main2" android:theme="@style/apptheme.noactionbar" > </activity>
well! oncreateactionmode trigger fine cab never show.
any ideas?
so here error
@override public boolean oncreateactionmode(actionmode mode, menu menu) { mode.getmenuinflater().inflate(r.menu.contextual_menu, menu); return true; // work fine }
set windowactionmodeoverlay theme.noactionbar
<item name="windowactionmodeoverlay">true</item>
don't have set startactionmode() toolbar saw on over stackoverflow thread. on android.support.v7.view.actionmode line work fine me.
main2activity.this.startsupportactionmode(new actionbarcallback()); //android.support.v7.view.actionmode
Comments
Post a Comment