android - How to set the starting position of a ScrollView? -


i have been trying set initial position of scroll view have not found way. have ideas? have googlemaps fragment children of scroll view.

thanks,

ryan

yes, possible:

scrollview.scrollto(int x, int y); scrollview.smoothscrollto(int x, int y); scrollview.smoothscrollby(int x, int y); 

can used that. x , y parameters coordinates scroll on horizontal , vertical axis.

example in code:

    @override        protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.your_layout);          scrollview sv = (scrollview) findviewbyid(r.id.scrollview);         sv.scrollto(0, 100);      } 

in example, once activity started, scrollview scrolled down 100 pixels.

you can try delay scrolling process:

final scrollview sv = (scrollview) findviewbyid(r.id.scrollview);  handler h = new handler();  h.postdelayed(new runnable() {      @override     public void run() {         sv.scrollto(0, 100);                 } }, 250); // 250 ms delay 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -