ViewPager和setClipChildren(假)解决方法2.x设备 [英] ViewPager and setClipChildren(false) workaround for 2.x devices

查看:2068
本文介绍了ViewPager和setClipChildren(假)解决方法2.x设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的戴维·史密斯的解决使ViewPager表现得像一个图片库。我的问题是setClipChildren(假)并没有在设备上与2.x的运行(试了的HTC Desire S和三星Galaxy S,都与2.3.5)。仅一个图像被示出,并且滚动只是viewpager区域内

I am using Dave Smith's solution to make ViewPager behave like an image gallery. My problem is that setClipChildren(false) does not work on devices with 2.x (tried on HTC Desire S and Samsung Galaxy S, both with 2.3.5). Only one image is shown, and scrolling is only inside the viewpager area.

搜索,我发现了两个解决方案:

Searching, I have found two solutions:

setClipChildren(false);
setLayerType(View.LAYER_TYPE_SOFTWARE, null);

设置为ViewPager的容器中,并在寻呼机,但setLayerType只对API的11以上。
和:

set to the container of the ViewPager, and on the pager, but setLayerType works only on API 11 and up. and:

android:hardwareAccelerated="false"

我为我的活动设置此清单中,第一,然后为整个应用程序。

I have set this in the manifest, first for my activity and then for the whole app.

无论是解决方案,为我工作。
我知道这是一个已知的Andr​​oid错误:这里信息>。你碰巧知道这是一个解决方法吗?谢谢你。

Neither of the solutions work for me. I know this is a known Android bug: info here. Do you happen to know a workaround for this? Thanks.

推荐答案

您应该尝试调用< setLayerType(View.LAYER_TYPE_SOFTWARE,NULL); >在持有该观点寻呼机容器。
来源: https://groups.google.com/forum/#​​!topic / Android的开发者/ RIERxUcGpQg

You should try to call < setLayerType(View.LAYER_TYPE_SOFTWARE, null); > on container that is holding the view pager. Source: https://groups.google.com/forum/#!topic/android-developers/RIERxUcGpQg

这篇关于ViewPager和setClipChildren(假)解决方法2.x设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆