The xml layout is as follows. I have a RelativeLayout that contains a TextView. The OnClick listener is set to RelativeLayout. RelativeLayout has a selector background. I want when the user clicks on the RelativeLayout, the background of the RelativeLayout should change, and the color of the TextView text will also change. Although I set the color selector for the TextView, only the RelativeLayout selector works. The color selector in TextView does not work. How can I implement changing the background and RelativeLayout of the background and TextView text when the user clicks the layout? Thanks.
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/background_selector" android:id="@+id/mylayout" > <TextView android:id="@+id/mytextview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:typeface="sans" android:textSize="18sp" android:textStyle="bold" android:singleLine="true" android:ellipsize="end" android:textColor="@drawable/color_blue_selector" /> </RelativeLayout>
source share