Reputation: 3541
I have created an activity and set toolbar as the actionbar which i have positioned at the bottom.
Inside that activity, I have a listview that contain some data.
Problem is, when I long press a list item, contextual action bar appears at the top instead of overlaying my toolbar which is positioned at the bottom.
my activity theme
<?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)
}
This is onCreateActionMode
method in my class that handle 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);
return true;
}
What should i do to make CAB appear at the bottom?
Upvotes: 1
Views: 1592
Reputation: 973
<!-- 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 Contextual action bar to overlay toolbar. And remove if you have used
<item name="windowActionBar">false</item>
. It worked for me.
Upvotes: 0
Reputation: 35661
Make your own CAB with a Toolbar. You can then put it wherever you like.
This project should give you a head start.
https://github.com/afollestad/material-cab
Upvotes: 2