Context action bar doesn't overlay my toolbar

I created an action and set the toolbar as the action bar that I installed at the bottom.

Inside this activity, I have a list containing some data.

The problem is that when I click on the list item for a long time, the contextual action bar appears at the top, and does not overlap my toolbar at the bottom.

topic of my work

<?xml version="1.0" encoding="utf-8"?> <resources> <!-- Base application theme. --> <style name="myActivityTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="windowActionBar">false</item> <item name="android:windowActionModeOverlay">true</item> </style> 

my toolbar

 <android.support.v7.widget.Toolbar android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:id="@+id/toorbar" android:background="@android:color/white" android:layout_gravity="bottom"> </android.support.v7.widget.Toolbar> 

my activity

 protected void onCreate(Bundle savedInstanceState){ ToolBar toolbar =(ToolBar) findViewById(R.id.toolbar) setSupportActionBar(toolbar) } 

What should I do for the CAB to overlay my toolbar?

EDIT

This is the onCreateActionMode method in my class that handles long clicks

 private class Selector implements AbsListView.MultiChoiceModeListener{ @Override public boolean onCreateActionMode(android.view.ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.my_activity_menu,menu); toolbar.setVisibility(View.VISIBLE); return true; } 
+7
android android-listview android-actionbar android-toolbar
source share
4 answers

If you want the Contextual ActionBar overlap over the Toolbar , use this

 <item name="windowActionModeOverlay">true</item> 

instead

 <item name="android:windowActionModeOverlay">true</item> 
+31
source share

You can try this topic, it can solve your problem.

  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="windowNoTitle">true</item> <item name="windowActionBar">false</item> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> 
+1
source share
 <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/color_primary</item> <item name="colorPrimaryDark">@color/color_primary_dark</item> <item name="colorAccent">@color/color_accent</item> <item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item> <!-- required for toolbar in prelolipop --> <item name="android:windowNoTitle">true</item> **<item name="windowActionModeOverlay">true</item>** </style> 

use <item name="windowActionModeOverlay>true</item> for the context action bar to overlay the toolbar. And delete if you used <item name="windowActionBar">false</item> . This worked for me.

0
source share

It worked for me

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="windowNoTitle">true</item> <item name="windowActionBar">false</item> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="windowActionModeOverlay">true</item> </style> 
0
source share

All Articles