我在我的項目中使用抽屜佈局。我想自定義抽屜,就像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項的一個片段加載到FrameLayout裏。這也是完美的。 但有一個問題。 ImageView也是「可點擊」的。所以,當抽屜打開時,一個人會點擊ImageView後面的ListView(在片段上)點擊!我不想那樣。所以我在ImageView上用clickable:false來嘗試它。不要工作...
對於這裏一點試玩視頻:http://www.vidup.de/v/Ao71r/
我怎樣才能讓ImageView的不要點擊?
謝謝。作品完美。但是,當我們想要「不可點擊」時,使得視圖可點擊的小curois :) – StefMa
如果我們使整個抽屜可點擊,它將保持抽屜下方的視圖看不到任何點擊。我用更多的解釋更新了我的答案,希望它有助於讓事情變得更清晰:) – anthonycr