我想在活动中使用appcompat v21工具栏。但我正在实现的工具栏在状态栏下方重叠。我怎样才能修好它
以下是活动布局xml:
<;LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android"
android:layout\u width=“fill\u parent”
android:layout\u height=“包装内容”
android:orientation=“vertical”>;
<;包括
android:id=“@+id/工具栏”
布局=“@布局/工具栏”/>;
<;框架布局
android:id=“@+id/容器”
android:layout\u width=“fill\u parent”
android:layout\u height=“0dp”
android:layout_weight=“1”/>;
</线性布局>;
工具栏视图:
<;?xml version=“1.0”encoding=“utf-8”?>;
<;android.support.v7.widget.Toolbar xmlns:android=”http://schemas.android.com/apk/res/android"
android:id=“@+id/工具栏”
android:layout\u width=“匹配父项”
android:layout\u height=“包装内容”
android:minHeight=“?属性/actionBarSize”
android:background=“?attr/colorPrimary”/>;
主题风格:
<;style name=“AppTheme”parent=“MaterialNavigationDrawerTheme.Light.DarkActionBar”>;
<;项目名称=“colorPrimary”&[email protected]颜色/原色</项目>;
<;项目名称=“colorPrimaryDark”&[email protected]颜色/原色\u深</项目>;
<;项目名称=“colorAccent”&[email protected]颜色/重音</项目>;
</风格>;
在布局的根视图中使用android:fitsystemwindows=“true”。
android:fitsystemwindows是一个
用于根据系统窗口调整视图布局的内部属性,例如
作为状态栏。如果为true,则将此视图的填充调整为离开
系统窗口的空间。仅当此视图处于启用状态时才会生效
非嵌入式活动必须是布尔值,为“真”或“假”
这也可能是对资源的引用(在
“@[package:]type:name”)或主题属性(格式为
“?[package:[type:]name”)包含此类型的值这对应于全局属性资源符号
安装系统窗口