开发者

TextView color change on focus/press

开发者 https://www.devze.com 2023-03-13 00:36 出处:网络
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 colo

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:lay开发者_运维技巧out_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.


Programmatically by textView.setDuplicateParentStateEnabled(true);

for your

TextView textView= new TextView(this);

0

精彩评论

暂无评论...
验证码 换一张
取 消