Reputation: 718
I've tried to implement translucent action bar, like described here:
effect should be like this:
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:
My minimum API is 21.
Upvotes: 0
Views: 49
Reputation: 2579
Add this in activity. window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
Upvotes: 1