您好我正在尝试实施ScrimInsetFrameLayout,因此我的导航抽屉将填充状态栏,就像Google的Play商店应用程序我正在使用scriminsetframelayout,首先我将此代码放入我工作区的android studio中https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/widget/ScrimInsetsFrameLayout.java然后我修改了这个xml文件:
<?xml version="1.0" encoding="utf-8"?>
<com.myapp.app.ScrimInsetsFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/navdrawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/navdrawer"
android:background="@color/navdrawer_background"
android:fitsSystemWindows="true"
app:insetForeground="#4000">
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- Main layout -->
<LinearLayout
android:id="@+id/activity_content_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar"/>
</LinearLayout>
<!-- Nav drawer -->
<com.app.aacplayer.view.DrawerView
android:id="@+id/drawer_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"/>
</android.support.v4.widget.DrawerLayout>
</com.myapp.app.ScrimInsetsFrameLayout>
但是我的应用程序无法正常崩溃并退出。我需要一些建议,非常感谢你。
这是我目前的代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.app.aacplayer.ScrimInsetsFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/navdrawer"
android:background="@color/drawer_bg"
android:fitsSystemWindows="true"
app:insetForeground="#4000">
<!-- Main layout -->
<LinearLayout
android:id="@+id/activity_content_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar"/>
</LinearLayout>
</com.app.aacplayer.ScrimInsetsFrameLayout>
<!-- Nav drawer -->
<com.app.aacplayer.view.DrawerView
android:id="@+id/drawer_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"/>
</android.support.v4.widget.DrawerLayout>