Status Bar Layout - Android Lollipop

I want my application to be able to realize this effect: enter image description here

when the status bar is translucent and the layout is behind the status bar. Each example I read on this subject is mainly related to the navigation box and mainly used ScrimInsetScrollView (or ScrimInsetsFrameLayout). I tried to implement this using ScrimInsetsFrameLayout.

Basically, I have an activity that contains a fragment, and this is my layout (the fragment is later added to the container in the onCreate method):

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:fitsSystemWindows="true" > <com.test.app.widget.ScrimInsetsFrameLayout xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:insetForeground="#4000" android:id="@+id/container" ></com.test.app.widget.ScrimInsetsFrameLayout> </FrameLayout> 

And also I installed android: statusBarColor transparent in themes. The solution does not work for me. Apparently I'm doing something wrong. Can someone please indicate where I am going wrong?

+6
source share
1 answer

You tried

 @Override public void onCreate(Bundle savedInstanceState) { getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); 

as described in the documentation for Android

-1
source

Source: https://habr.com/ru/post/983537/


All Articles