[Solved] ScrollView rendering problem on RC1

Please answer these questions to help fix this issue:
What’s the issue?
when adding ui::ScrollView on scene, something wrong on android device.

What’s the engine version?
cocos2d-x 3.0 RC1

How to reproduce it?
I just add below code in HelloWorldScene.cpp

auto scrollView = ui::ScrollView::create();
scrollView->setSize(Size(200,200));
scrollView->setPosition(Point(100,100));
scrollView->setBackGroundColorType(ui::LayoutBackGroundColorType::LAYOUT_COLOR_SOLID);
scrollView->setBackGroundColor(Color3B::BLUE);
scrollView->setBackGroundColorOpacity(128);
addChild(scrollView);


on_desktop.jpg (112.8 KB)


on_android_device.png (18.4 KB)

What is wrong with it?

These are screen shot I attached above.
After adding scrollview, screen goes white on android device.

I found a log from logcat.

04-03 20:06:38.390: D/cocos2d-x debug info(13901): Stencil buffer is not enabled.

is it might be related?

I solved this issue by adding some code in AppActivity.java

package org.cocos2dx.cpp;

import org.cocos2dx.lib.Cocos2dxActivity;

public class AppActivity extends Cocos2dxActivity {
}

to…

package org.cocos2dx.cpp;

import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;

public class AppActivity extends Cocos2dxActivity {
    public Cocos2dxGLSurfaceView onCreateView() {
        Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
        glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
        
        return glSurfaceView;
    }
}
1 Like