Thesalan - Calling setLayerType() on just the View will work, but you have to do it on the correct view. In this case, the issue that doesn't work with hardware acceleration is the parent ViewGroup clipping its children, so the PagerContainer in the example is the view that you need to call it on, not the ViewPager itself. If you modify PagerContainer.java in the gist like so:
private void init() { setClipChildren(false); setLayerType(View.LAYER_TYPE_SOFTWARE, null); } You should be able to enable hardware acceleration in your manifest and the pager code will still work as expected. I will update the gist example when I have a spare moment with some discussion, and I have starred the issue Mark created (you should do the same). Cheers, Dave Smith @devunwired On Monday, August 27, 2012 2:29:20 AM UTC-6, Thesalan wrote: > > Hi! > > I started Android development last week, and I have a problem with a code > on some devices : > > I have to develop an application with a specific controller like a > horizontal wheel. To do this, I want to use the ViewPager, with > setClipChildren(false) to extend the view. I based on the following code : > https://gist.github.com/8cbe094bb7a783e37ad1 > > The result looks like this : > > > <https://lh4.googleusercontent.com/-DjFOnG7O0wY/UDstWN3AE2I/AAAAAAAAAfE/yWpndOBTWIA/s1600/emulator.png> > The ViewPager here is just on "Item4", and with setClipChildren(false) we > can see the other item. > > This works greats on emulator (tested on API 7 to 16) and some devices! > > But I encounter some problems on more recent devices, like HTC One X > (Android 4.0.4) and a Nexus S (CM10 - Android 4.1.1) : the ViewPager > doesn't really extended! Just the current item is shown, and when you are > sliding, the next item is shown : > > > <https://lh3.googleusercontent.com/-clS7voj3rLk/UDsvfP1HnhI/AAAAAAAAAfM/K8uMV_9PLFA/s1600/onex_current.png> > > When sliding : > > > <https://lh5.googleusercontent.com/-3tYaKu_Oz7w/UDsvnljXJ0I/AAAAAAAAAfU/JEaCZolThJ4/s1600/onex_sliding.png> > > > > Anybody else already encounter this problem? I think is an optimization on > these devices, but how can I bypass this? > > Thanks in advance! > > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en