我有下一个布局的活动:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayoutWidget"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/containerProgress"
android:layout_width="match_parent"
android:clickable="false"
android:layout_height="match_parent"
android:background="#4777">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>
</FrameLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/widgetRecyclerView"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/windowBackground"
android:scrollbars="vertical" />
</android.support.v4.widget.DrawerLayout>
Container containerProgress
(progressBar)显示在屏幕中的所有其他元素上。
行。
展示containerProgress
时我需要点击屏幕上的任何项目。
但我可以点击drawerlayout hamburger icon
。
我可以disable click on hamburger icon
containerProgress
展示什么?
答案 0 :(得分:0)
设置空单击侦听器以切换
toggle.setOnClickListener(view -> {
// We ignore it
}
你想再次启用它:
toggle.setOnClickListener(null);
或强>
您可以使用
隐藏它toggle.setDrawerIndicatorEnabled(false);
或强>
如果在&#34;禁用,请点击&#34;你的意思是&#34;防止抽屉被打开&#34;你可以这样做:
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
当你想启用它时:
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)