ViewPager and setClipChildren(false) workaround for 2.x devices

邮差的信 提交于 2019-12-11 01:04:22

问题


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);

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.

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.


回答1:


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



来源:https://stackoverflow.com/questions/12495344/viewpager-and-setclipchildrenfalse-workaround-for-2-x-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!