我使用DrawerLayout,最近我想改變drawerLayout中listView的引力。但之後,我從android:layout_gravity="start"
改變的ListView重力android:layout_gravity="start|bottom"
,drawerLayout不能鎖爲什麼我無法鎖定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>
`
的任何線索,爲什麼我不能用與其他比重鎖定模式?
謝謝!
謝謝。我已經解決了將列表視圖添加到另一個佈局的問題。但是這段代碼解釋了我的問題。 –
不客氣!恭喜找到你想達到的替代方案:-) –
正確的答案,但他們也應該支持'END'和'START' –