Featured post
android - Scrollbars in TextView -
i didn't want use scrollview. have textview enabled vertical scrollbars.
<textview android:id="@+id/tv_service_ticketinfo_details" android:layout_width="fill_parent" android:layout_height="150dp" android:textcolor="@color/black" android:autolink="web" android:scrollbars="vertical" android:text="empty" android:background="@drawable/custom_shape_grey"> </textview>
the problem is, scrollbars scrollable texts, contain web-links. other texts see scrollbar, can't scroll.
i can't explain it. , you?
upd:
another strange thing: once set text links, can replace 1 without links , textview stays scrollable
so think problem textviews don't automatically scroll, because set android:scrollbars. have set scrollingmovementmethod.
however, when use autolink , links found, android framework set movementmethod you. that's why behaviour's different.
there 2 solutions work me.
after set our text, force movement method 1 supports links , scrolling.
final textview output = (textview) findviewbyid(r.id.output); output.settext(content); // ensure text scroll or without linked text output.setmovementmethod(linkmovementmethod.getinstance());
or set movement method, assuming plaintext, before adding text textview. if autolink detects links, change movement method itself.
final textview output = (textview) findviewbyid(r.id.t_output); // ensure text defaults scrollable output.setmovementmethod(scrollingmovementmethod.getinstance()); output.settext(content);
(fyi: i'm using android:autolink="all"
)
- Get link
- X
- Other Apps
Comments
Post a Comment