Android ScrollView scrollTo() method not working with TextView? -
for example, have layout this:
<scrollview> <linearlayout> <linearlayout> ... </linearlayout> <linearlayout> ... </linearlayout> <linearlayout> <textview> </textview> </linearlayout> </linearlayout> </scrollview>
my textview have long content. can scroll scrollview manually end of textview content. in code, write: scrview.scrollto(0, 800);
, scrview scrollview. supposed scroll middle of textview content. when running, scrolled start of textview , can't scroll through textview content.
does know causing problems?
edit: found it. seems call scrollto soon. using
scrview.post(new runnable() { public void run() { scrview.scrollto(0, 800); } });
instead , works. posted answer getting same problem.
first of all, if linearlayouts have same orientation, why don't create once? if i'm not wrong, scrollview can have 1 child (1 direct child). maybe that's reason of problems. however, if still want 3 linearlayouts, can create framelayout parent hold them , make framelayout child of scrollview
Comments
Post a Comment