如何在android中更改可点击文本视图的颜色

如何在android中更改可点击文本视图的颜色,android,textview,Android,Textview,我想更改链接(文本视图)的默认颜色 如果要更改整个TextView的textcolor,只需调用TextView.setTextColor(R.color.text\u color) 如果只想对TextView的部分文本着色,请执行以下操作: final SpannableStringBuilder stringBuilder = new SpannableStringBuilder("your-string"); final int start = 0, end = textView.getT

我想更改链接(文本视图)的默认颜色


如果要更改整个
TextView
的textcolor,只需调用
TextView.setTextColor(R.color.text\u color)

如果只想对
TextView
的部分文本着色,请执行以下操作:

final SpannableStringBuilder stringBuilder = new SpannableStringBuilder("your-string");
final int start = 0, end = textView.getText().length(); // Change to the start/end of the part to colorize

// Apply some text-color
stringBuilder.setSpan(new ForegroundColorSpan(getResources()
     .getColor(R.color.text_color)), start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE);

// Apply changes to TextView
textView.setText(stringBuilder);

注意:使用字符串资源,不要传递原始字符串(
“通过继续,我同意HCP用户协议和服务条款”
-->更改为类似于
getString(R.String.accept_User_Agreement)

ss.setSpan(新ForegroundColorSpan(Color.RED),48,65,Spannable.SPAN_EXCLUSIVE\u)
我有他们使用wordtoSpan.setSpan(新的ForegroundColorSpan(Color.BLUE)、15、30、Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)的代码;但是我应该在哪里通过clickablespanobject@Raghunandan那么我应该在哪里通过这个物体呢ClickableSpan@Loren .
final SpannableStringBuilder stringBuilder = new SpannableStringBuilder("your-string");
final int start = 0, end = textView.getText().length(); // Change to the start/end of the part to colorize

// Apply some text-color
stringBuilder.setSpan(new ForegroundColorSpan(getResources()
     .getColor(R.color.text_color)), start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE);

// Apply changes to TextView
textView.setText(stringBuilder);