简体   繁体   English

Android:ViewPager中的Vertical ScrollView —无法滚动

[英]Android: Vertical ScrollView inside a ViewPager — unable to scroll

In my app, I have a ViewPager which contains 4 pages . 在我的应用程序中,我有一个ViewPager ,其中包含4个页面 The root element of two of those pages is a ScrollView . 其中两个页面的根元素是ScrollView My problem is that I can perfectly scroll the ScrollView on my 4.2 Android Phone, but on my 2.3 Android Phone I can't. 我的问题是我可以在4.2 Android Phone上完美滚动ScrollView ,但在2.3 Android Phone上却无法滚动。

So inside the ScrolView there are cliclable Views ... I can click on them, but if I move my finger on it up and down the ScrollView doesn't gets scrolled . 因此,在ScrolView中有可浏览的视图 ...我可以单击它们,但是如果我在其上上下移动手指,则ScrollView 不会滚动 If I move my finger on the screen where there is only the ScrollView, it scrolls. 如果我在只有ScrollView的屏幕上移动手指,它将滚​​动。 Why is this? 为什么是这样? If I simply use the ScrollView layout without the ViewPager around it, the scrolling works perfectly on a 2.x and also on a 4.x Android Phone . 如果我只使用ScrollView布局而不使用ViewPager,则滚动可以在2.x以及4.x Android Phone上完美运行。

Actually it was my fault. 其实这是我的错。 The simple ScrollView works perfectly inside a ViewPager. 简单的ScrollView可以在ViewPager内完美运行。 I have a ListView inside another ViewPager and there I had to make some tricks to make the ListView works, and from this I thought that I have to make the same tricks with the ScrollView too. 我在另一个ViewPager中有一个ListView,在那里我不得不做一些技巧以使ListView起作用,并且从此我以为我也必须对ScrollView做同样的技巧。 But I didn't, and that was the problem. 但是我没有,这就是问题所在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM