Why can’t we use a Translucent system bars with and ActionBar

You can create your own theme with android.R.attr#windowTranslucentStatus set to true to achieve the same effect without losing the ActionBar.

From the docs:

Flag indicating whether this window requests a translucent status bar.
Corresponds
to {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_STATUS}.

Styles – Remember, these would go in values-v19.

<style name="TranslucentStatusBar" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/TranslucentActionBar</item>
    <item name="android:windowTranslucentNavigation">false</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

<style name="TranslucentActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@android:color/transparent</item>
</style>

Layout

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/holo_blue_dark"
    android:fitsSystemWindows="true" >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/holo_purple" />

</FrameLayout>

Results

enter image description here

Leave a Comment

techhipbettruvabetnorabahisbahis forumu