【发布时间】:2017-02-04 13:12:13
【问题描述】:
问题:我创建了包含 Drawer 和 FrameLayout 的 Activity,它们将被片段膨胀。
<?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/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<FrameLayout
android:id="@+id/main_fragment_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!-- The navigation drawer -->
<RelativeLayout
android:layout_width="200dp"
android:layout_height="match_parent"
android:id="@id/drawerPanel"
android:layout_gravity="start"
android:background="@color/backgroundColor">
<-- CONTENT->>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
在将片段更改/膨胀到 FrameLayout main_fragment_panel 后,抽屉应该打开(日志中的所有内容看起来都很好),但看起来片段从活动中溢出了所有内容。如何更改布局的“级别”或“优先级”?
更新:我已经更新了上面的代码 - 现在可以正常显示,但没有处理来自 (那里有一些带有监听器的按钮)
【问题讨论】:
-
将 FrameLayout 放入 DrawerLayout 标签内
-
谢谢@tahsinRupam。请单独发布,以便我可以标记为答案;)顺便说一句。现在菜单中的项目不可点击:(
-
我已经编辑了我的答案。让我知道这是否有效:)
标签: android android-layout android-fragments