【发布时间】:2014-12-08 04:06:54
【问题描述】:
在我的 layout-sw600dp-land 文件夹中,此布局文件用于应用开始的主要活动。应用启动后,会以编程方式将两个片段添加到相关的框架布局中。
此当前布局导致工具栏被推回两个框架布局的后面。
viewpager 片段和右侧的片段占据了工具栏的空间,工具栏被推回到它们后面。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="horizontal" >
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:theme="?attr/ToolBarStyle" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal" >
<FrameLayout
android:id="@+id/fragment1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingRight="4dp" />
<FrameLayout
android:id="@+id/fragment2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingRight="4dp" />
</LinearLayout>
<include layout="@layout/nav_drawer_layout" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
双窗格(片段)工具栏布局的适当语法是什么?
【问题讨论】:
-
DrawerLayout 适用于 2 个视图。在您的情况下,您有 3 个(至少)视图。
-
@GabrieleMariotti 你会如何建议如何创建我想要创建的布局类型?
-
@GabrieleMariotti 在两个框架布局的顶部添加边距可以让工具栏变得可见,有没有更优雅的解决方案?
-
在第一个 LL 中移动工具栏。
-
当我将工具栏移动到第一个 LL 内和 DL Screenshot 之前会发生这种情况@
标签: android android-layout android-toolbar