【发布时间】:2014-03-24 17:36:52
【问题描述】:
我在我的项目中使用抽屉布局。我想像 Google+ Android 应用一样自定义抽屉。在“主”ListView 上,我添加了一个 ImageView。那工作很好。代码是:
<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="wrap_content"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="@+id/drawer_layout_relative"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_gravity="start" >
<ImageView
android:id="@+id/drawer_header_image"
android:layout_width="wrap_content"
android:layout_height="85dp"
android:src="@drawable/ic_logo_blue" />
<ProgressBar
android:id="@+id/drawer_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/drawer_header_image"
android:background="#ffffffff" />
<ListView
android:id="@+id/drawer_listview"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_below="@id/drawer_progress"
android:background="#ffffffff"
android:choiceMode="singleChoice" />
</RelativeLayout>
当您单击其中一个 ListView-Items 时,片段会加载到 FrameLayout 中。那也很完美。 但是有一个问题。 ImageView 也是“可点击的”。这样,当抽屉打开时,一个会点击 ImageView 后面的 ListView(在片段上)被点击!!我不想那样。所以我在 ImageView 上尝试了 clickable:false 。不要工作...
这里有一个小演示视频:http://www.vidup.de/v/Ao71r/
如何让 imageview 不可点击?!
【问题讨论】:
标签: android imageview navigation-drawer