TextView, autolink and no scrolling

412 views Asked by At

I have a TextView that can't fit it's content (I'm animating the height). Now that I've added autolinking, the view can be scrolled whenever it's height is smaller that it should be. How do I disable this? description.setMovementMethod(null); blocks link clicking and description.setMovementMethod(LinkMovementMethod.getInstance()); scrolls.

Edit: I haven't found how fix this, though I've found a workaround.

if(descriptionCropped){
    descriptionCropped = false;
    //enable movement on expanded view
    description.setMovementMethod(LinkMovementMethod.getInstance());
}else{
    descriptionCropped = true;
    //disable movement on cropped view, have to reset onClick for some reason
    //workaround for scrolling text when the view is smaller than it's content
    description.setMovementMethod(null);
    description.setOnClickListener(this);
}

Where this is an OnClickListener.

0

There are 0 answers