I'm adding contextual action bar after long click of RecyclerView
element. Problem is toolbar is still visible. Contextual action bar doesn't overlap completely.
Tried searching for info, but no or very little info found.
My toolbar:
After adding contextual action bar:
As you can see toolbar is still visible at the bottom.
Theme im using:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
</style>
My toolbar:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"
android:minHeight="?android:attr/actionBarSize"
android:background="#F7F8F9"
app:titleTextColor="@color/colorPrimaryDark" />
cab.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_upload"
android:title="Upload"
android:icon="@drawable/ic_file_upload_black_24dp"
app:showAsAction="always" />
<item
android:id="@+id/action_reboot"
android:title="Reboot"
android:icon="@drawable/ic_refresh_black_24dp"
app:showAsAction="always"/>
</menu>
This is how i'm starting Contextual action bar:
startSupportActionMode(new android.support.v7.view.ActionMode.Callback() {
@Override
public boolean onCreateActionMode(android.support.v7.view.ActionMode mode, Menu menu) {
mode.getMenuInflater().inflate(R.menu.cab, menu);
return true;
}
@Override
public boolean onPrepareActionMode(android.support.v7.view.ActionMode mode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(android.support.v7.view.ActionMode mode, MenuItem item) {
return false;
}
@Override
public void onDestroyActionMode(android.support.v7.view.ActionMode mode) {
}
});
My readings:
contextual action bar padding in Android
Contextual action bar does not overlay my toolbar
Tried pretty much everything from questions above. None of them have helped.
P.S. Tried increasing/decreasing size of the toolbar, but visible line is still visible
So how to make Contextual action bar overlap toolbar completely?
Add
<item name="actionModeBackground">your_color</item>
in your styles.xml
file, it will overlay your toolbar completely.