I have been trying to use UIScrollView. I’m having a a few problems with it while running the game on iOS.
First, there is a green background on in the back of the ScrollView. Changing the background opacity of both the ScrollView and the inner container does nothing, I’m guessing it’s due to something in the rendering of panel/view.
Second, the ScrollView doesn’t seem to clip anything. If I add a background with setBackgroundImage(“image.png”) the image takes up the entire screen, even after I have set setClippingEnabled(true) or whatever the method is. I’m using MenuItemImages and they freely scroll beyond the limits of the ScrollView.
Here is my code (without any of the things I’ve tried to resolve these problems like setBackgroundColorOpacity or setClippingEnabled(true))
Have the same problem with scroll view of green colour on some Android devices.
I have tried to paste the code from @owen to AppActivity.java and also to Cocos2dxGLSurfaceView class, but build failed both times.
How can I remove this green background colour of ScrollView? Can somebody help me? (cocos2d-x 3.2)
UPDATE:
Solution found. To avoid some androids having green background (which is setting in UILayer class),
we have to add this to scroll view
If you disable clipping, the behavior of scrollview is incorrect.
i think you should only copy my code to appActivity.java if you use cocos2d-x v3.2 and before.
After v3.3 rc, there is no need to set these args any more, we have a uniform way to set these settings in AppDelegate. It is working on both iOS and Android.
@owen, I have V3.3 rc , and i have the same problem when i run TransitionPageTurn on a scene that contains scrollView .( This problem not exist if i desable clipping, but the behavior of scrollview is incorrect.), please help me.
i have created a layerColor, then i added it to the Mainlayer, after i have created a scrollView which is child of layerColor, i have many scenes with the same structure(because i’m working on an interactive book)