【发布时间】:2013-08-27 02:41:39
【问题描述】:
我使用DrawerLayout,最近我想改变drawerLayout 中listView 的重力。但是在我将listView的重力从android:layout_gravity="start"更改为android:layout_gravity="start|bottom"后,drawerLayout不能锁定到
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
setDrawerLockMode() 使用;
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<ListView
android:id="@+id/drawer_list"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#F3F3F4"
android:choiceMode="singleChoice" >
</ListView>
但它不锁定;
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<ListView
android:id="@+id/drawer_list"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start|bottom"
android:background="#F3F3F4"
android:choiceMode="singleChoice" >
</ListView>
`
任何关于为什么我不能在其他重力下使用锁定模式的线索?
谢谢!
【问题讨论】:
-
另外,为了处理重力,请在此处检查我的答案:stackoverflow.com/a/50304856/2873702
标签: android listview gravity drawerlayout