mikolaj-jalocha
mikolaj-jalocha

Reputation: 718

Translucent Status Bar is not translucent

I've tried to implement translucent action bar, like described here:

effect should be like this:

enter image description here

I've made following changes to my layout:

> <androidx.coordinatorlayout.widget.CoordinatorLayout  
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".fragments.HotelFragment">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:fitsSystemWindows="true">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            .....
            android:fitsSystemWindows="true">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="200dp"
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"
                android:src="@drawable/d" />

            <androidx.appcompat.widget.Toolbar
                     ....
                android:background="@android:color/transparent"
               />

        </com.google.android.material.appbar.CollapsingToolbarLayout>
    </com.google.android.material.appbar.AppBarLayout>

In themes:

    <item name="android:windowTranslucentStatus">true</item>>

Effect is like:

enter image description here

My minimum API is 21.

Upvotes: 0

Views: 49

Answers (1)

Vidyesh Churi
Vidyesh Churi

Reputation: 2579

Add this in activity. window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)

Upvotes: 1

Related Questions