0
我试图让导航抽屉内的片段填满屏幕(match_parent),即用户选择抽屉内的设置,设置frag打开填充屏幕。然而,对于我目前的布局,带有测试按钮的父(主)活动仍保留在屏幕上,即该片段不仅仅填充屏幕的一部分。我非常喜欢使用frag和nag抽屉,我确信它的简单,任何帮助表示赞赏。导航抽屉片段项目填写家长
我的活动布局XML与片段容器:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/container_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
</LinearLayout>
<LinearLayout
android:id="@+id/container_body"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_category"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:text="Movies"
/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<fragment
android:id="@+id/fragment_navigation_drawer"
android:name="com.app.fragments.MainDrawerFragment"
android:layout_width="@dimen/nav_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="@layout/fragment_main_navigation_drawer"
tools:layout="@layout/fragment_main_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>