Questions tagged [clickablespan]
42 questions
2
votes
0 answers
Is there a way to make a ClickableSpan background round?
Is there a way to make the background of the ClickableSpan class rounded instead of the default rectangle? This is my base custom ClickableSpan class:
public class TagSpan extends ClickableSpan {
@Override
public void onClick(View widget) {
…

Alex
- 31
- 4
2
votes
2 answers
ClickableSpan avoid touch propagation to parent view
I have a SpannableString set as the text of my TextView which is inside another view that has a click handler. I've got ClickableSpans inside my text which are, you are right, clickable.
My problem is that I need touch events to be captured in case…

Can Poyrazoğlu
- 33,241
- 48
- 191
- 389
2
votes
1 answer
ClickableSpan not clickable in custom view (not TextView)
In our app we want to improve scroll speed via drawing custom views with text. Problem is ClickableSpan not clicked. For TextView we can use
textView.setMovementMethod(LinkMovementMethod.getInstance());
But what can I do to make link clicking work…

Rafael
- 6,091
- 5
- 54
- 79
2
votes
2 answers
GridView: Using RecyclerView or Simply TextView with clickable words
So, Does anybody know how to create following grid? I need to set clickable event to every word:
If four words are not fit to a line then should be shown three in a line:
if it will be exceed to a line n words then should be shown n words in a…

SBotirov
- 13,872
- 7
- 59
- 81
1
vote
3 answers
very difficult to long click TextView when set the part of the textView is clickable using SpannableString
I set the part of the textView is clickable using SpannableString. But it is very difficult for me to detect a long press my textView.
private fun makeTextLink(textView: TextView, str: String, underlined: Boolean, color: Int?, action: (() -> Unit)?…

NDC00
- 11
- 2
1
vote
1 answer
Android: ClickableSpan does not match text at end of lines in an EditText. How can I fix this?
I want to set ClickableSpans for each character in an EditText, but their positions do not match the character at the end of each line.
Each letter has a ClickableSpan set to it using BreakIterator. Each Clickable opens an AlertDialog showing the…
1
vote
0 answers
RecyclerView - Is it correct to set a ClickableSpan Listener inside onBindViewHolder?
Is it correct to set ClickableSpan listeners inside RecyclerView's onBindViewHolder? For viewHolder I would be to implement a View.OnClickListener inside the viewHolder
public class ViewHolder extends RecyclerView.ViewHolder implements…

WHOATEMYNOODLES
- 845
- 9
- 25
1
vote
1 answer
ClickableSpan is not retaining activity on rotation
I'm setting clickablespan on a substring of a string and showing a dialogfragment in onClick.
When I click the text for the first time, the dialogfragment shows normally. After dismissing the dialog, I rotate the screen and click the text again, it…

X09
- 3,827
- 10
- 47
- 92
1
vote
1 answer
Android ClickableSpan not changing style onclick
I have a TextView in which all words are individually clickable. I want to begin with every word unstyled. Upon clicking a word, the word should become and remain underlined. I am able to clear the default underline, but nothing happens upon click.…

Matt Robertson
- 2,928
- 5
- 34
- 62
0
votes
0 answers
ClickableSpan doesn't work in Talkback mode when the text is long
I have a simple demo app, where I use ClickableSpan to make a specific text as clickable. I works well when Talkback is OFF, of course.
But when Talkback is ON,
If I use rawText = shortRawText, it works fine
If I use rawText = longRawText, 10…

Hiep Mai Thanh
- 113
- 2
- 9
0
votes
1 answer
Not works clickable spans with talkback 12.2 on android 11 (api 30)
I have a custom view,which contains clickable span. But if i go to talkback menue,links and press on my link,nothing happens. But i expect to see notification. Whether it's issue,which should be reported to google? Thanks everybody for any…

alexandr kozlovskiy
- 54
- 2
- 7
0
votes
0 answers
When I split the char how can use spannable or ClickableSpan to get values?
When I split the char how can use spannable or ClickableSpan to get values?
this is a code
StringBuilder sb = new StringBuilder();
String data = newFeedModel.getFeedTags();
String[] items = data.split("#");
for…

James
- 3
- 3
0
votes
0 answers
Clickable Span not being set for multiple words
I don't know if there is an exact solution to my problem on SO, but I have been stuck in this for a long time and need to unblock myself.
I have a string "0000 111 222", and I need to set a link to it. My code to set it is like…

Akriti Anand
- 166
- 3
- 17
0
votes
0 answers
Could we define unknown amount of clickable texts which have different outputs in for loop?
I want all ClickableSpans to have toasts show their own text. But whatever I write in Toast in onClick in for loop, all ClickableSpans show same Toast output. Briefly, I just want ClickableSpans to show different Toasts in for loop. How can I do it?…

Baris
- 31
- 5
0
votes
0 answers
Toggling Dark Mode removes TextView clickable spans
I have a TextView that I fill with internal app links using ClickableSpans. I'm using Kotlin, but I'll take answers in Kotlin or Java.
val spannableString = SpannableString(myTextView.text)
val clickableSpan = object : ClickableSpan() {
…

Cullub
- 2,901
- 3
- 30
- 47