My Android app has a translucent ActionBar
. It hides when I touch the screen and shows up again when the screen is touched again.
<style name="FullscreenTheme" parent="android:Theme.Holo">
<item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">@null</item>
<item name="buttonBarStyle">?android:attr/buttonBarStyle</item>
<item name="buttonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
</style>
<style name="FullscreenActionBarStyle" parent="android:Widget.Holo.ActionBar">
<item name="android:background">@color/black_overlay</item>
</style>
When I start the app, the ActionBar
is translucent, that's the expected state. When I hide it using getActionBar().hide();
and make it show up again using getActionBar().show();
it's not translucent anymore.
It's a Fragment
in a ViewPager. If I just scroll right, hide and show works like expected: the ActionBar
is translucent after show();
gets called.
Update: Everytime I scroll left, the bug is there again.
Has anybody an idea how to fix this, so it works also on the first page or when the user has scrolled one or more to the left?
I solved my problem:
The layout of the view inside the ViewPager was the following:
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/presentation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:contentDescription="@string/presentation"
android:scaleType="fitCenter"
android:fitsSystemWindows="true" >
</ImageView>
android:fitsSystemWindows="true"
was responsible for this weird bug, without this, all works fine.
And sorry for writing so less code, I just thought it was a javacode-issue and not related to the xml. And I could not find a codeblock, that approx. would be the one with the error in it. How should I, the error was in my layout-file. ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With