[英]Android navigation drawer: Dock item or group to bottom
在Navigation Drawer fragment
,需要放置一个scrollview
然后在其中放入LinearLayout
,它将具有可滚动的视图,而在scrollview之外,您必须使用layout:gravity:bottom
制作另一个LinearLayout
,因为它位于scrollview之外。将不会滚动并保持在底部:)
如#deep513所述,您必须修改导航抽屉片段。 这是一个示例,在这种情况下,我使用了列表视图而不是滚动视图,但这取决于您的需求。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".NavigationDrawerFragment">
<ListView
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#cccc"
android:choiceMode="singleChoice"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Help"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Settings"/>
</LinearLayout>
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.