In my project I have a screen that uses action mode via:
mActionMode = getActivity().startActionMode(this);
I need this to "overlay" my action bar rather than push everything down. I achieve this using the following theme:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowActionModeOverlay">true</item>
</style>
So far this has worked fine when using version 22.1.0 of the appcompat library:
compile 'com.android.support:appcompat-v7:22.1.0'
This is the result - perfect -
Recently I upgraded to version 22.2.0 of the appcompat library:
compile 'com.android.support:appcompat-v7:22.2.0'
Now I have the following:
As you can see, the "overlay" behaviour is completely broken. Am I missing something here?
FYI - I am using a ToolBar in my XML layout and then using:
activity.setSupportActionBar(mToolbar);
You should use the appcompat
style attribute, without the framework prefix:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionModeOverlay">true</item>
</style>
I'm not 100% sure, but I believe that for newer API versions it would be good to also keep the framework version, thus:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionModeOverlay">true</item>
<item name="android:windowActionModeOverlay">true</item>
</style>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.