У меня есть TextView
со многими ClickableSpan
.
При нажатии на ClickableSpan
мне нужно получить координату на экране (чтобы показать пользовательскую View
в его позиции).
Проблема в том, что я понятия не имею, как я могу это сделать. Метод onClick()
ClickableSpan
дает мне параметр a View
, TextView
, который содержит ClickableSpan
.
Я использовал следующее, чтобы получить позицию символов в TextView
, но я не знаю, как я могу преобразовать его, чтобы получить положение x/y на экране текста.
@Override
public void onClick(View v){
SpannableString completeText = (SpannableString)((TextView) v).getText();
Log.v("characters position", completeText.getSpanStart(this) + " / " + completeText.getSpanEnd(this));
}
Заранее благодарим за помощь!
EDIT: я хочу получить всю координату ClickableSpan и ее размер, цель состоит в том, чтобы показать мой пользовательский вид в нижней части текста. Метод onTouch даст мне положение пальца, а не все текстовые координаты. Таким образом, с помощью этого метода у меня не будет середины текста.