Android的TextView的:文字的颜色上点击 [英] android TextView : Change Text Color on click

查看:296
本文介绍了Android的TextView的:文字的颜色上点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框的行为就像是本地链接,点击它获取的图像从数据库中,并显示它。它并不能ping到服务器的所有的时间。

I have a textfield that behaves like a local link, clicking on it fetches an image from database and shows it. It doesn't ping to server all the time.

下面是XML code文本视图

Here is the xml code for the text view

<TextView android:layout_marginLeft="2dp" android:linksClickable="true"
            android:layout_marginRight="2dp" android:layout_width="wrap_content"
            android:text="@string/Beatles" android:clickable="true" android:id="@+id/Beatles"
            android:textColor="@color/Black"
            android:textSize="12dp" android:layout_height="wrap_content" android:textColorHighlight="@color/yellow" android:textColorLink="@color/yellow"  android:autoLink="all"></TextView>

现在的问题是我希望看到的文本视图颜色应为黄色被改变,而不是相同的黑色为主色调,

The question is i want to see the color of text view should be changed in yellow, instead of the same black color,

俨然不是改变背景颜色的按钮的行为,但我想改变文字颜色

Just Like the button behavior but instead of changing the background color i want to change a text color

推荐答案

看看这里: <一href="http://developer.android.com/reference/android/content/res/ColorStateList.html">http://developer.android.com/reference/android/content/res/ColorStateList.html

在这里!: 如何定义ColorStateList为TextView的?

这篇关于Android的TextView的:文字的颜色上点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆