pez
pez

Reputation: 4235

Overlaying the action bar

I have an activity which displays a fullscreen bitmap image. When the user clicks on the image, the action bar will be hidden. Currently, the bitmap will resize once the action bar is hidden. To address this issue, I have tried overlaying the action bar, as described in the developer guides.

<resources>

    <style name="AppTheme" parent="@android:style/Theme.Holo">
        <item name="android:homeAsUpIndicator">@drawable/ic_ab_back_holo_dark_am</item>
        <item name="android:actionBarStyle">@style/NormalActionBarTheme</item>
    </style>

    <style name="NormalActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
        <item name="android:windowActionBarOverlay">true</item>
        <item name="android:background">@color/my_green</item>
    </style>

</resources>

This displays my solid green action bar, but the windowActionBarOverlay call doesn't seem to do anything- the bitmap will still resize when I hide the action bar.

My minimum sdk is currently set to 16/Jelly Bean/4.1.x, and I am running Lollipop.

What did I do wrong? I appreciate any advice. Thanks!

Upvotes: 0

Views: 118

Answers (1)

CodeZero
CodeZero

Reputation: 179

Set the overlaying option directly to your app's style theme.

<style name="AppTheme" parent="@android:style/Theme.Holo">
    <item name="android:homeAsUpIndicator">@drawable/ic_ab_back_holo_dark_am</item>
    <item name="android:actionBarStyle">@style/NormalActionBarTheme</item>
    <item name="android:windowActionBarOverlay">true</item>
</style>

Upvotes: 2

Related Questions