ViewPager滚动问题的Andr​​oid

ViewPager滚动问题的Andr​​oid

本文介绍了ViewPager滚动问题的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有包含图片的动态数量ViewPager。
这ViewPager添加为自定义行到表视图。
由于此表视图可以有多个动态自定义行,我一定要在滚动视图加入这个表视图滚动。

I have a ViewPager with dynamic number of images in it.This ViewPager is added as a custom row to a table view.As this table view can have multiple dynamic custom rows, I have to add this table view in a scrollview for scrolling.

现在我的问题 - 当我水平与一些垂直滚动以及滚动查看传呼机..其不完全水平滚动..其混合作为。所以当检测到垂直滚动时的事件被传递到滚动视图...这使得ViewPager重置为初始position.So我怎样才能传回的事件ViewPager或避免滚动视图捕捉垂直滚动事件。
我试图禁用滚动视图垂直滚动但是从力捕捉垂直滚动事件停止

Now my question - as when I am scrolling horizontally to View Pager.. its not exactly horizontal scrolling.. its mixed with some vertical scrolling as well. So when a vertical scrolling is detected the events are passed to the scroll view... which makes the ViewPager reset to the initial position.So how can I pass back the events to ViewPager or avoid scrollview catching vertical scroll events.I tried disabling scrollview to vertical scrolling but that dint stop it from capturing the vertical scroll events

请给我留言,如果没有明确这个问题。

Please give me a shout if nothing clear about this issue.

我坚持......
帮助

I am stuck...Help

拉​​吉

推荐答案

我发现我的问题的解决,这是我如何做的。

I found the solution for my question and this is how I did it.

我在骑上触摸事件为我Viewpager以下列方式

I over ride the on touch event for my Viewpager in the following way

myViewPager.setOnTouchListener(new OnTouchListener() {

                public boolean onTouch(View v, MotionEvent event) {

                    if(event.getAction() == MotionEvent.ACTION_MOVE && myScrollView!=null){
                        myScrollView.requestDisallowInterceptTouchEvent(true);
                    }
                    return false;
                }
            });

请注意:myScrollView是myViewPager的父母在我的问题说。
和多数民众赞成...我得到这个问题解决了。我希望这个帮助别人

Note:myScrollView is parent of myViewPager as said in my Question.and thats it... I got the issue solved. I hope this help others

这篇关于ViewPager滚动问题的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 18:00