我有一组由ImageButton,ImageView和TextView组成的视图。
的代码看起来是这样的:ImageButton和TextView的不同状态
<ImageButton
android:id="@+id/imagebutton_com"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@drawable/bean_bg"
/>
<ImageView
android:id="@+id/imageview_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/arrow_1"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
/>
<TextView
android:id="@+id/textview_wizard_main_button"
android:text="Soybeans"
android:layout_toRightOf="@id/imageview_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17sp"
android:textStyle="bold"
android:textColor="@color/white"
android:layout_margin="10dp"
/>
所有工作正常,但我想,当按钮被聚焦到改变的TextView的文字颜色。
我试着写一个选择器xml文件来做同样的事,但没有任何工作。
有什么建议吗?
选择器只对运行活动视图。您不能使用它来更改另一个视图的文本颜色。你应该接受@ waqastam的回答 – 2016-06-03 16:25:04