hey trying change textcolor
in textview
when user press it. trying make hyperlink button in windows 8
. have selector in res/color folder
.
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_hovered="true"> <color android:color="@color/darkblue"/> </item> <item android:state_pressed="true"> <color android:color="@color/lightblue"/> </item> <item android:color="@color/black"/> <!-- default color --> </selector>
and use this
<textview android:id="@+id/tw_language" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbaseline="@+id/language_label" android:layout_marginright="3dp" android:clickable="true" android:autolink="all" android:text="@string/default_language_label" android:textcolor="@color/language_button" />
in activity when reference textview set mlanguage.setpaintflags(mlanguage.getpaintflags() | paint.underline_text_flag);
to underlined text. , app crashes using this. if set
android:background="@color/language_button"
instead of textcolor
works fine. know doing wrong?
you need add attribute textview below
<textview android:id="@+id/txtresult" style="@drawable/language_button" android:layout_width="match_parent" android:layout_height="wrap_content" />
style="@drawable/language_button"
selector file. have defined file in drawable/stack.xml
directory.
Comments
Post a Comment