Dean Wild
Dean Wild

Reputation: 5964

Why does appcompat-v7:22.2.0 break ActionMode overlaying ActionBar?

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 -

enter image description here

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:

enter image description here

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);

Upvotes: 1

Views: 227

Answers (1)

natario
natario

Reputation: 25194

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>

Upvotes: 1

Related Questions