焦点/ preSS TextView的颜色变化 [英] TextView color change on focus/press
本文介绍了焦点/ preSS TextView的颜色变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些UI部件包括TextView的内部RelativeLayout的是点击。我的问题是,当RelativeLayout的获取正确聚焦,虽然我已经设置TextView的颜色属性的TextView文字颜色没有变化。
有没有简单的方法来级联重点childview相对布局里面,一样的ListView项目。
< RelativeLayout的
机器人:ID =@ + ID / top_layout
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentTop =真
机器人:背景=@可绘制/ selector_white_blue
>
<的TextView
机器人:ID =@ + ID /名称
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:layout_alignParentLeft =真
机器人:TEXTSIZE =@扪/ text_size_med
机器人:文字颜色=@色/ black_text_white_focused
机器人:TEXTSTYLE =黑体
机器人:文本=电影名称
/>
< / RelativeLayout的>
解决方案
指定安卓duplicateParentState =真正的
在的TextView
。
I have a some ui widgets including textview inside RelativeLayout which is clickable. My problem is textview text color does not change when relativelayout gets focus although I have set textview color property correctly.
Is there any easy way to cascade focus to childview inside relative layout, same as listview items.
<RelativeLayout
android:id="@+id/top_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/selector_white_blue"
>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:textSize="@dimen/text_size_med"
android:textColor="@color/black_text_white_focused"
android:textStyle="bold"
android:text="Movie Name"
/>
</RelativeLayout>
解决方案
Specify android:duplicateParentState='true'
on your TextView
.
这篇关于焦点/ preSS TextView的颜色变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文