【发布时间】:2017-08-01 11:25:23
【问题描述】:
Android 应用使用全屏显示导航栏、状态栏和工具栏后面的内容。我想在这些栏后面有一些不的内容。如何确定没有这些条的区域?据我了解,某些条的位置取决于设备。
【问题讨论】:
标签: android android-view android-statusbar android-window windowinsets
Android 应用使用全屏显示导航栏、状态栏和工具栏后面的内容。我想在这些栏后面有一些不的内容。如何确定没有这些条的区域?据我了解,某些条的位置取决于设备。
【问题讨论】:
标签: android android-view android-statusbar android-window windowinsets
这就是android:fitsSystemWindows="true" 派上用场的地方。将此应用于您的视图将使其具有必要的填充,以便它不会被布置在系统视图下方。
更多详情请见this answer。
【讨论】:
Standard layouts like FrameLayout , LinearLayout or RelativeLayout will not pass window insets to their children, whereas “materialish” layouts will do。那里提供了解决方案。