androidandroid-viewandroid-statusbarandroid-windowwindowinsets

Determine content area without navigation bar and status bar


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.


Solution

  • 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.