An Android app uses full screen showing content behind the navigation bar, status bar, and toolbar. I'd like to have some contents not behind these bars. How to determine the area without these bars? As my understanding, the locations of some bars are device dependent.
Asked
Active
Viewed 136 times
1 Answers
1
That's where android:fitsSystemWindows="true"
would come handy. Applying this to your view would make it have necessary padding so that it won't be laid out below system views.
See this answer for more details.

azizbekian
- 60,783
- 13
- 169
- 249
-
Thank you. It looks like what I need. However, something is weird. I have a RelativeLayout with an android.support.v7.widget.Toolbar inside on the top. It also uses android:fitsSystemWindows="true". After adding android:fitsSystemWindows="true" to a RelativeLayout beneath it, the toolbar appears behind the status bar. The toolbar looks perfect if android:fitsSystemWindows="true" is not used for the RelativeLayout beneath it. Do you have any idea why so? – Hong Aug 01 '17 at 12:23
-
1In [this article](https://medium.com/@azizbekian/windowinsets-24e241d4afb9): `Standard layouts like FrameLayout , LinearLayout or RelativeLayout will not pass window insets to their children, whereas “materialish” layouts will do`. Solution is provided there. – azizbekian Aug 01 '17 at 12:25