How to make links among other accessibility oriented texts

I have a CheckedTextBox whose text consists of two SpannableStrings, one of which is URLSpan.

My question is: how can I make it so that the user can move the focus of accessibility through each interval, ultimately focusing on the URL itself? setMovementMethodand setLinksClickabledon't seem to work for me.

SpannableStringBuilder builder = new SpannableStringBuilder();

SpannableString label = new SpannableString(getString(R.string.label));
label.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.text_color_primary)), 0, label.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.append(label);

SpannableString link = new SpannableString(getString(R.string.link);
link.setSpan(new URLSpan(mUrl), 0, link.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.append(link);
builder.append(".");

mCheckedTextBox.setText(builder);

//The following two methods do not work for what I'm trying to accomplish:
mCheckedTextBox.setMovementMethod(LinkMovementMethod.getInstance());
mCheckedTextBox.setLinksClickable(true);

Android, , , , . , , , . https://support.google.com/accessibility/android/answer/6378148?hl=en

.

+4

Source: https://habr.com/ru/post/1648289/


All Articles