【问题标题】:Determine content area without navigation bar and status bar确定没有导航栏和状态栏的内容区域
【发布时间】:2017-08-01 11:25:23
【问题描述】:

Android 应用使用全屏显示导航栏、状态栏和工具栏后面的内容。我想在这些栏后面有一些的内容。如何确定没有这些条的区域?据我了解,某些条的位置取决于设备。

【问题讨论】:

    标签: android android-view android-statusbar android-window windowinsets


    【解决方案1】:

    这就是android:fitsSystemWindows="true" 派上用场的地方。将此应用于您的视图将使其具有必要的填充,以便它不会被布置在系统视图下方。

    更多详情请见this answer

    【讨论】:

    • 谢谢。它看起来像我需要的。然而,有些奇怪。我有一个RelativeLayout,顶部有一个android.support.v7.widget.Toolbar。它还使用 android:fitsSystemWindows="true"。将 android:fitsSystemWindows="true" 添加到其下方的 RelativeLayout 后,工具栏将出现在状态栏的后面。如果 android:fitsSystemWindows="true" 没有用于它下面的 RelativeLayout,那么工具栏看起来很完美。你知道为什么会这样吗?
    • this articleStandard layouts like FrameLayout , LinearLayout or RelativeLayout will not pass window insets to their children, whereas “materialish” layouts will do。那里提供了解决方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多