您好,登錄后才能下訂單哦!
String url = data.blockChainUrl; //https or http url
SpannableStringBuilder builder = new SpannableStringBuilder("");
int start = builder.length();
String content = mContext.getResources().getString(R.string.block_chain_query); //填充字體顏色
builder.append(content);
int end = builder.length();
builder.setSpan(new URLSpanNoUnderline(url) {
@Override
public void onClick(View widget) {
super.onClick(widget);
}
}, start, end, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
builder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(mContext, R.color.color_a5ef44)), 0,
end, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
mBlockChainQuery.setText(builder);
//必須有的set mBlockChainQuery.setMovementMethod(LinkMovementMethod.getInstance());
//自定義一個URLSpan
class URLSpanNoUnderline extends URLSpan {
public URLSpanNoUnderline(String url) {
super(url);
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
//you self
}
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。