【发布时间】:2016-03-17 23:59:54
【问题描述】:
我对 DrawerLayout 有疑问。我设法做了一个抽屉,这不是问题。但主要内容不显示。
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Holy Operating Systems!"
android:textSize="24sp" />
</FrameLayout>
<fragment
android:id="@+id/left_drawer"
class="com.app.fragments.CustomFragment"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start" /> </android.support.v4.widget.DrawerLayout>
我尝试了所有可能的组合。即使我删除片段主要内容仍然不显示。
有人能发现问题吗?
【问题讨论】:
-
您有多个匹配的父母,尝试删除或更改一个?
-
@Rykuno,你到底是什么意思?根据developer.android:将您的主要内容视图定位为第一个孩子,宽度和高度为match_parent
标签: android drawerlayout