Android: Preventing scrollview from scrolling automatically when hiding/showing views within it -
i'm having scrollview in layout lot of views.
within scrollview i'm having layout 1 particular item
<scrollview> ... <framelayout> <view1/> <view2 hidden/> </framelayout> ... </scrollview> ____________ ____________ | | | | | | | view 2 | | view 1 | | | | | | | | | ------------ ------------ i'm animating views this:
- on action: sliding view view1 out , view2 in (hiding view1)
- on other action: sliding view view2 out , view1 in (hiding view2)
my problem is: on doing these actions, scrollview scrolling automatically (which not looking good).
probably cause : changing visibility of views.
i tried 2 things:
- disabling vertical scrolling didn't help
remembering scrolly in onanimationstart , restoring scroll position in onanimationend - problem approach is, visible scrollview moved (although moved fast).
this idea came mind, didn't know how implement this: keeping upper views (wrt framelayout) , shifting lower views fill space, vertical scrolly value remains same.
is there way can implement this? if not, there other way can achieve this?
is there way partially redraw scrollview?
try this:
yourview.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { return true; } }); if yourview has ontouchlistener, make return true in case.
Comments
Post a Comment