fitsSystemWindows 对软键盘的影响

fitsSystemWindows effects on softkeyboard

我有以下 xml:

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    **android:fitsSystemWindows="true"**
    >

我的应用没有操作栏或导航栏。我真的需要这个属性吗?我担心当用户尝试软键盘时会有什么影响

是的,否则视图将假定状态栏仍然存在或出现类似错误。查看文档:

http://developer.android.com/reference/android/view/View.html#attr_android:fitsSystemWindows

希望这对您有所帮助。每当您从视图中删除 app/status 条时,请添加该行以确保视图相应地扩展。否则你会得到一些奇怪的 UI 错误。它也只需要在 XML 视图文件的父布局属性中声明,而不是子项(即按钮等)。