android - ScrollView ScrollBy method takes 2 parameters -


scrollview layout vertical scroller.

why scroll view method takes x parameter while scrolls vertically?

shouldn't take y parameter? since x parameter useless.

any ideas?

code comes scrollview.class.
scrollview need call view's scrollto(x, y), takes 2 parameters.
therefore, view's subclass, including scrollview, can scroll x axis , y axis.

@override public void scrollto(int x, int y) {     // rely on fact view.scrollby calls scrollto.     if (getchildcount() > 0) {         view child = getchildat(0);         x = clamp(x, getwidth() - mpaddingright - mpaddingleft, child.getwidth());         y = clamp(y, getheight() - mpaddingbottom - mpaddingtop, child.getheight());         if (x != mscrollx || y != mscrolly) {             super.scrollto(x, y);         }     } } 

then why scrollview scrolls in vertical direction?
@ public boolean ontouchevent(motionevent ev) method in scrollview.
handles ev.gety() !
on other hand, horizonalscrollview handles ev.getx().


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -