android - How to detect whether the user is moving the button to top/or bottoom using onTouchListener -
android - How to detect whether the user is moving the button to top/or bottoom using onTouchListener -
i have custom view, takes touch events.as result, cannot utilize scrollview. since page size small, want scroll view, using custom scrollbar button. don't how scroll view manually. can help me implement feature.
updated: i'm able scroll view. problem i'm facing how observe whether scroll view or bottom on button click. right i'm using ontouchlistner scroll down.
@override public boolean ontouch(view v, motionevent event) { if (v == mscrollbtn) { int scrollbarheight = mscrollbar.getheight(); // if (event.getaction() == motionevent.action_down) { // int containerheight = mfreeformcontainer.getheight(); layoutparams params = (layoutparams) mscrollbtn.getlayoutparams(); params.topmargin = scroll_factor*mtopmargin; mtopmargin = mtopmargin + 1; if (params.topmargin <= mscrollbar.getheight()-mbottompadding) { mscrollbtn.setlayoutparams(params); // scrolldown(view.focus_down); msignatureview.scrollto(0, mscrollbtn.getheight() +scroll_factor* mtopmargin); // scrolldown(); }
where
private int mtopmargin = 2; private static int scroll_factor=2;
android button scroll ontouchlistener ontouch
Comments
Post a Comment