2
我想更改鏈接(textview)的默認顏色。如何更改android中可點擊文本視圖的顏色
SpannableString ss = new SpannableString("By continuing,I agree to HCP User Agreement and Terms of Services ");
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View textView) {
startActivity(new Intent(UserRegister.this, ForgotPassword.class));
}
};
ss.setSpan(clickableSpan, 48, 65, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
TextView textView = (TextView) findViewById(R.id.termsAndConditions);
textView.setText(ss);
textView.setMovementMethod(LinkMovementMethod.getInstance());
'ss.setSpan(new ForegroundColorSpan(Color.RED),48,65,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)' – Raghunandan
我有他們使用wordtoSpan.setSpan(new ForegroundColorSpan(Color.BLUE),15,30, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);但那麼我應該在哪裏通過clickablespan對象 – Loren
http://stackoverflow.com/questions/15851655/android-change-the-background-color-of-a-clickablespan-when-clicked –