所以我的XML是这样的:
So my XML goes like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_height="56dp"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
<FrameLayout
android:id="@+id/main_frag"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- ListView here -->
</android.support.v4.widget.DrawerLayout>
这是怎么回事,即使我把我的身高明确为56dp,在工具栏
行事像 match_parent
和遗嘱屏幕的整个高度?是否有这样做的更好的办法?
What is happening, even though I set my height explicitly as 56dp, the toolbar
is acting like match_parent
and wills the entire height of the screen? Is there a better way of doing this?
或者我应该把在一侧的布局,我的 FragementTransaction
个饱了的FrameLayout
工具栏来?这似乎不是有效的,因为我有几个的那些。
Or should I be putting the toolbar in side the layouts that my FragementTransaction
s fill the FrameLayout
with? Which doesn't seem efficient because I have several of those.
DrawerLayout
有两个孩子的意见:先为主要内容,第二个抽屉:既总是被设置为 match_parent
。因此,你的工具栏
和的FrameLayout
应包装在垂直的LinearLayout
被设置为 match_parent
按href=\"http://stackoverflow.com/a/26440880/1676363\">典型的例子来自中的