OnClickListener for specific text in a TextView

Is it possible to use any existing onClickListiner to click on specific TextView text. if not, is it possible to link 2 text views to look like 1 text view. I do not mean in horizontal or vertical order, but when one TextView ends at this point, another begins.

+3
source share
3 answers

You can use ClickableSpan. See this answer for an example.

+1
source

Try to use TextWatcher. Just change the focus from the first glance to another in the method beforeTextChanged (CharSequence s, int start, int count, int after), when the s.length() ==length of the sequence in which you want to be the first TextView.

0

You can try to implement your custom view based on TextView. In dispatchTouchEvent (MotionEvent event) you can provide calculations depending on the size of the text, paddings, etc., which could say that it was part of the view that was clicked.
In any case, in case you will achieve the ultimate goal of your separate clicks, advise, perhaps, more accurete.

0
source

All Articles