부모 선형 레이아웃을 클릭하면 버튼의 텍스트 색상을 변경하고 이미지를 수정하고 싶습니다. 이미지가 변경되지만 선형 레이아웃을 클릭하면 텍스트 색상이 변경되지 않습니다.부모 LinearLayout의 onclick 버튼의 TextColor가 변경되지 않습니다.
<LinearLayout
android:id="@+id/btn_layout"
android:layout_width="0.0dip"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1.0"
android:gravity="center"
android:clickable="true"
android:orientation="horizontal" >
<Button
android:id="@+id/done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/done_with_accounts_action"
android:textColor="@drawable/done_button_text_selector"
android:focusable="false"
android:textSize="@dimen/done_button_text_size" />
<ImageView
android:id="@+id/done_btn_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="4dp"
android:focusable="false"
android:src="@drawable/done_btn_arrow_bg_selector" />
</LinearLayout>
**selector xml for button -**
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:color="@color/done_btn_pressed_color" />
<item android:state_pressed="true" android:color="@color/done_btn_pressed_color" />
<item android:color="@color/button_text_white_color" />
</selector>
내가 텍스트 뷰와 버튼을 교체하는 경우, 모든 것이 잘 작동 -
다음은 XML 내 코드입니다. 이 라인에서
아니요. 문제가되지 않습니다. 기본 색상이 다릅니다. – Sunita
코드에서 변경하려고 할 수 있습니다. – dasdasd
시도했습니다. button [textcolor 변경] 및 imageview [change image]에 대해 두 개의 다른 XML 선택기가 있으므로 선형 레이아웃으로 설정할 수 없습니다. 단추 레이아웃을 변경하면 도움이되지 않습니다. – Sunita