Android: fitsSystemWindows not working on toolbar

I am using the android library Android-ObservableScrollView from ksoichiro. I use its Flexible Space sample with a viewpager, and I modify it. But there is some kind of problem. You can see in my xml there are 2 android: fitsSystemWindows. One in LinearLayout and the other in the toolbar. The LinearLayout works well. but the toolbar does not work. Why is this happening? Thanks. Sorry for my bad english

theres my xml code:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/image" android:layout_width="match_parent" android:layout_height="@dimen/flexible_background" android:scaleType="centerCrop" android:src="@drawable/bridge" /> <View android:id="@+id/overlay" android:layout_width="match_parent" android:layout_height="@dimen/flexible_background" android:background="?attr/colorPrimary" /> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:fitsSystemWindows="true"> <FrameLayout android:id="@+id/header" android:layout_width="match_parent" android:layout_height="@dimen/flexible_height"> <TextView android:id="@+id/title" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:layout_gravity="bottom" android:layout_margin="@dimen/abc_action_bar_default_padding_material" android:ellipsize="end" android:gravity="center_vertical" android:maxLines="1" android:minHeight="?attr/actionBarSize" android:textColor="@android:color/white" android:textSize="20sp" /> </FrameLayout> <com.bright.nongkrongyuk.ui.SlidingTabLayout android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:background="@android:color/black" app:sliding_textColor="@drawable/sliding_tab_profile" /> <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/background_light" /> </LinearLayout> </com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@android:color/transparent" android:minHeight="?attr/actionBarSize" android:fitsSystemWindows="true" /> </FrameLayout> 
+6
source share
1 answer

The android:fitsSystemWindows sets the add-on. This means that the fitting is applicable to performances for children. You will have to apply this either to your FrameLayout , or place the Toolbar in a nested Layout

It is very difficult to make the correct full-screen layout with the views installed on the screen. I have subclassed Fragment, where I can declare a content view that will receive an addition depending on the Status- and / or Navigationbar

+12
source

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


All Articles