带有textview和listview的抽屉导航 [英] Drawer Navigation with textview and listview
本文介绍了带有textview和listview的抽屉导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Android的标准抽屉导航中添加TextView
.但是我真的不知道如何使用它.这就是我到目前为止所拥有的.
I'm trying to include a TextView
to the standard Drawer Navigation for android. But i really don't know how to use it. This is what i have thus far.
<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">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
<LinearLayout
android:layout_width="240dp"
android:layout_height="match_parent"
android:gravity="left"
>
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="Algemeen"
android:background="@drawable/title_menu"
android:textColor="#94A1A1"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:layout_weight="1"
android:gravity="start"
/>
<ListView
android:id="@+id/left_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#323232"
android:layout_weight="1"
android:gravity="start"
/>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
我得到一个错误:No drawer view found with absolute gravity LEFT
.有人可以帮我吗?
I get an error: No drawer view found with absolute gravity LEFT
. Could someone help me?
推荐答案
我认为问题在于线性布局中的android:gravity ="left".文档建议您使用layout_gravity ="start",它应该可以满足您的要求.
I think the problem lies with android:gravity="left" in linear layout.Docs recommend to use layout_gravity="start" and that should fulfill your requirement.
这篇关于带有textview和listview的抽屉导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文