Tôi sử dụng DrawerLayout và gần đây tôi muốn thay đổi trọng lực của listView trong drawerLayout. Nhưng sau khi tôi thay đổi lực hấp dẫn của ListView để android:layout_gravity="start|bottom"
từ android:layout_gravity="start"
, DrawerLayout không thể khóa đểTại sao tôi không thể khóa DrawerLayout với bố cục trọng lực
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
setDrawerLockMode() làm việc với;
<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>
Nhưng nó không khóa với;
<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>
'
Bất kỳ manh mối về việc tại sao tôi không thể sử dụng chế độ khóa với trọng lực khác?
Cảm ơn!
Cảm ơn. Tôi đã khắc phục sự cố này khi thêm chế độ xem danh sách vào một bố cục khác. Nhưng mã này giải thích câu hỏi của tôi. –
Bạn được chào đón! Xin chúc mừng bạn đã tìm kiếm giải pháp thay thế cho những gì bạn muốn đạt được :-) –
Câu trả lời đúng, nhưng họ cũng nên hỗ trợ 'END' và' START' –