我有一個可點擊的Relativelayout
。我有一個內部元素(一個ImageButton
),我也想點擊。實現父母和子女的可點擊視圖
佈局是可點擊的,直到我加入ImageButton
;現在只有這是可點擊的。
我已經在兩個元件(我只在xml
佈局試過)嘗試的focusable
和focusableInTouchMode
= true
和false
所有組合。我怎樣才能讓它們都是可點擊的?
我的代碼;注意這是在ListView
裏面,每一行都有這個;還有圍繞這一非點擊LinearLayout
:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/row_selector"
android:duplicateParentState="true"
android:paddingBottom="10dp" >
// several TextViews edited out
<ImageButton
android:id="@+id/ibMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@color/row_overflow_state"
android:contentDescription="menu"
android:src="@drawable/ic_action_overflow" />
</RelativeLayout>
我厭倦了這一點,它不工作;儘管我已經在父母和孩子中刪除了所有「focusable」的實例。我會在問題中添加更多代碼。 – KickingLettuce
@KickingLettuce你想爲相對佈局和按鈕或只有一個事件生成單擊事件 – Trikaldarshi
只使用這個'android:duplicateParentState =「true」'使得兩個項目現在不可點擊。 – KickingLettuce