【发布时间】:2019-02-04 08:24:18
【问题描述】:
我的 Android 应用中有导航抽屉,其可见性由操作栏中的应用图标控制。但是,我需要能够关闭抽屉,不仅可以通过点击应用程序图标,还可以在用户点击屏幕的空白(未占用)部分时。这是我的主要布局:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:background="@color/white"
style="@style/ListViewSeparator"/>
我不明白哪个布局是我需要设置侦听器的布局,因为当我打开导航抽屉时,它包含我的“240dp”列表视图,但屏幕的其余部分变得像“透明黑色”,我我正在寻找屏幕其余部分的“透明黑色”布局
【问题讨论】: