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>