3

Is it possible to use any existing onClickListiner to make click on specific text of TextView. if there is not then is it possible to link 2 text views, to look like 1 text view. I mean not in horizontal or not in vertical aligment, but when finishes one TextView from that point starts another.

Neznajka
  • 35
  • 3

3 Answers3

1

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

Community
  • 1
  • 1
Steve Prentice
  • 23,230
  • 11
  • 54
  • 55
0

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

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
amukhachov
  • 5,822
  • 1
  • 41
  • 60
0

You can try to implement your custom view based on TextView. In the dispatchTouchEvent(MotionEvent event) you can provide calculations depending on text size, paddings and so on that could tell that exactly part of view was pressed.
Anyway, in case if you'll grovide final goal of your separated clicks, advise could be more accurete.

woodshy
  • 4,085
  • 3
  • 22
  • 21