我的应用程序中有一个导航抽屉(appcompat v7),它工作得很好.
现在我想禁用它,直到用户购买应用程序内购买以解锁其他功能.所以在我的Activity.onCreate()初始化抽屉并填充它之后,我调用了这个函数:
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
Run Code Online (Sandbox Code Playgroud)
这个功能没有做任何事情.在操作栏中点击抽屉克拉后,抽屉继续正常打开和关闭.我尝试调用此函数Activity.onResume()没有任何区别.
使用此功能的正确方法是什么?(我试着在网上寻找答案,但找不到任何解决我问题的方法).任何帮助都表示赞赏,因为我现在已经坚持这个问题很长一段时间了.
我使用DrawerLayout,最近我想在drawerLayout中改变listView的重力.但是在我将listView的重力改为android:layout_gravity="start|bottom"from后android:layout_gravity="start",drawerLayout无法锁定
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
但它没有锁定;
<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>
Run Code Online (Sandbox Code Playgroud)
`
任何线索为什么我不能使用其他重力的锁模式?
谢谢!