I'm using clickable span in a textView to enable only part of the text to be clickable. It works fine except that the textView is scrolling down and that's something I don't want. It happens because I use LinkMovementMethod that scrolls if needed. Is there anyway to cancel the scrolling?
SpannableString ss = "My text [click area] end."
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View textView) {
// My click action
}
};
// Set the span
String fromString = "text";
int startClickPos = ss.toString().indexOf(fromString)+fromString.length()+1;
int endCickPos=startClickPos+ 12;
ss.setSpan(clickableSpan, startClickPos, endCickPos, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(ss);
textView.setMovementMethod(LinkMovementMethod.getInstance());