开发者

How to Handle TouchEvents for Child View(CustomView) in Parent View (ScrollView)?

In my app i am using ScrollView for scrolling the ImageView, and i will add one customview dynamically to that ScrollView overlay of ImageView, i have onTouch events for customview. after adding to the scroll view i am not able to use the touch listeners of customview, still scrollview was working on that.

how to stop the scrollview touch listeners, and how to enable our custom view touch list开发者_JAVA技巧eners..


I suggest you not to go with ScrollView. Simply add your custom view in LinearLayout and implement OnGestureListener and then using GestureDetector you can able to listen all events(like onDown(),onFling(),onScroll(),onSingleTapUp(),onDown(),etc). You can sense scroll magnitudes and then by using scrollBy() method you can scroll your image(custom view). For more detilas you can refer following posts: Smooth scrolling in Android

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜