Android Difference between View.getLeft() vs View.getScrollX() -
what difference between view.getleft() vs view.getscrollx() ? please don't copy , paste definition documentation, because below
getscrollx()
return scrolled left position of view.
getleft()
left position of view relative parent
i think 2 values should same, sample program of mine, if view.scrollby(20, 0) see getscrollx() return 20 , view moved right, getleft() remains zero
i confused, because if visually view being scrolled right 20px, left position should updated well, still 0
obviously can't same, otherwise there no need have 2 different methods return same result
please help
getleft()
returns views location relative parent. how has scrolled not impact @ all. scrolling impacts contents of view, not location.
a quote android documentation regarding getleft():
for instance, when getleft() returns 20, means view located 20 pixels right of left edge of direct parent.
getscrollx()
, on other hand, lets know how content in view has moved.
view.scrollby(20,0) affects content in view (like subviews of view) , doesn't move view relative view's parent.
Comments
Post a Comment