how to find end of scroll value for HorizontalScrollView
- by DroidCoder
i need to implement following scenario,
here i have two horizontalScrollViews the upper scrollView is a main menu and lower scrollView is a submenu.
when i scroll main menu,the menu which comes under center arrow will show its submenu in lower scrollview and from the lower scrollview, the submenu which comes under center arrow shows the screen for that sub-menu.
here's my requirement:
i've implemented it using HorizontalScrollViews and ViewFlipper and also it works but it will give correct result only when i scroll it slowly and not when scroll fast.
i've used onTouch() method with a ACTION_UP event,so when i release finger from screen it will gives me getScrollX() position at that point but here i need getScrollX() position when scroll is finished/stop.
here's my code:-
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (v.getId()) {
case R.id.mHorizontalScrollViewMain:
if (event.getAction() == KeyEvent.ACTION_UP) {
Log.d("test", " " + hsvUpperTab.getScrollX() + " , "+ mViewFlipper.getChildCount());
getUpperTabScrolled(hsvUpperTab.getScrollX());
}
break;
case R.id.mHorizontalScrollViewSub:
if (event.getAction() == KeyEvent.ACTION_UP) {
Log.d("test1", " " + hsvLowerTab.getScrollX());
getLowerTabScrolled(hsvLowerTab.getScrollX());
}
default:
break;
}
return false;
}