Skip to content Skip to sidebar Skip to footer

Actions Of Horizontalscrollview Inside Viewpager

I need to place HorizontalScrollView inside ViewPager. Every child of ViewPager is ScrollView with HorizontalScrollView inside. I zoom child of HorizontalScrollView. After it I nee

Solution 1:

implementing onTouch and onClick will consume the touch event by onTouch and consider it consumed and not pass it on to the other various touch handlers which make your onClickListener useless. the Documentation:

onTouch() - This returns a boolean to indicate whether your listener consumes this event. The important thing is that this event can have multiple actions that follow each other. So, if you return false when the down action event is received, you indicate that you have not consumed the event and are also not interested in subsequent actions from this event. Thus, you will not be called for any other actions within the event, such as a finger gesture, or the eventual up action event.

here is some of the available solutions to handle this situation:

1-you can use onToach and onClick as an inner classes instead of implementing each listener.

2- you can use onToach to detect a tab event:

if (gestureDetector.onTouchEvent(arg)) {
                // single tapreturntrue;
            } else {
                // action up or down code 
            }

Post a Comment for "Actions Of Horizontalscrollview Inside Viewpager"