Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
String user_agree_policy_1 = UIUtil.getString(R.string.user_agree_policy_1);
String user_agree_policy_2 = UIUtil.getString(R.string.user_agree_policy_2);
String user_agree_policy_3 = UIUtil.getString(R.string.user_agree_policy_3);
String text = user_agree_policy_1 + user_agree_policy_2 + user_agree_policy_3;
SpannableString spannableString = new SpannableString(text);
spannableString.setSpan(new ClickableSpan() {
@Override
public void onClick(View widget) {
Toast.makeText(context,"jump to one page",Toast.LENGTH_LONG);
}
}, 0, user_agree_policy_1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableString.setSpan(new ClickableSpan() {
@Override
public void onClick(View widget) {
Toast.makeText(context,"jump to two page",Toast.LENGTH_LONG);
}
}, (user_agree_policy_2 + user_agree_policy_1).length(), text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
tvAgreePolicy.setText(spannableString);
tvAgreePolicy.setMovementMethod(LinkMovementMethod.getInstance());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.