it may be duplicated ,i searched for the answer but unfortunately i didn't found the answer ..
i have relative layout that is nested with table row and and image view and text view
<!-- add photo image -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_weight="1.5"
android:id="@+id/layot_attach"
android:clickable="true"
android:focusable="true"
android:background="@drawable/photo_button_selector"
android:layoutDirection="rtl">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/ic_add_photo_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:focusable="false"
android:clickable="false"
android:src="@drawable/ic_attach_file_white_48dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"
android:textColor="@color/white"
android:id="@+id/textView_attach"
style="@style/title"
android:padding="5dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp" />
</TableRow>
</RelativeLayout>
and when i click on the layout my method is called except when i click on the first nested image view (ic_add_photo_image)
i added the clickable and focusable withe false values to the image view but that dosent some to work
here is my selector photo_button_selector
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/photo_button_pressed" /> <!-- pressed -->
<item android:drawable="@drawable/photo_button" /> <!-- default -->
did i miss any thing , can some one help me to fix it or explain ?
here is my listner :
layoutattach = (RelativeLayout) findViewById(R.id.layot_attach);
layoutattach.setOnClickListener(this); // method called
EDIT
i didnot solve the proplem the way i wanted to
i declared my image icon in the code and attach alistenr to it .. i lost the effect of button click .. but that will do it for now