I have reproduced your problem. Thanks for reporting.
_scrollView->setClippingType(Layout::ClippingType::SCISSOR);
would solve your problem.
My dear @owen, iām sorry but i have another clipping problem .
in my interactive book app, i give the ability to the user to hide/show the scrollView , so i used this code:
void MainLyer::callBack(cocos2d::Ref *sender) {
if (_slideLayer->getPosition()==Vec2::ZERO) {
//hide the _layerColor
_layerColor->runAction( Sequence::create(EaseBackOut::create(MoveTo::create(0.5f, Vec2(0, -_layerColor->getContentSize().height))),
NULL ));
}else {
_layerColor->runAction( Sequence::create(EaseBackIn::create(MoveTo::create(0.5f, Vec2(0,0))),
NULL)
);
}
}
The problem is : when i hide the _layerColor
, the _scrollView
still showing !
Please help me.
but in my case, i made animation( MoveTo) to take the scrollView off the screen, and this problem exists only if i use this _scrollView->setClippingType(Layout::ClippingType::SCISSOR);
If you want to move the scrollView, you might need to change the clipping type to STENCIL again.
Currently, Iām sorry, noā¦
Just wanted to share that after moving from 3.2 to 3.3 all my ListViews started to have green backgrounds and incorrect clipping. It worked absolutely fine in 3.2.
Problem went away when I added Owenās code
void AppDelegate::initGLContextAttrs()
{
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
GLView::setGLContextAttrs(glContextAttrs);
}
I use 3.10 and scrollerview still green and no clipping on Android device. Please help me !
@C7an I ran into this problem using 3.11 setting the clipping type to SCISSOR seems to make it work. I read in another old post that some devices donāt support scissor clipping. Is that still a concern? It only occurrs on an android emulators ran on windows. Other computers (linux) and real android devices work as expected. Bluestacks on the same computer even works.
This has to do with the android emulator. See this topic and star it if you want google to fix it: https://code.google.com/p/android/issues/detail?id=207017
Has anyone seen this recently on anything other than the android emulator that wasnāt fixed by the posts towards the top of this topic or this topic: [solved] Ui::ScrollView size issues ?
Iāve just bumped into this testing pre-release on Android Simulator on OSX and it still happens, so itās not a Windows-only issue. I definitely already have the fix above too.
Iām about to go into beta so will see if this occurs on any physical devices too and report backā¦
Iāve already submitted a fix to Cocos, but for some reason they havenāt applied it. Itās easy to fix. Hereās my quote from the GitHub Issue:
Iāve managed to fix this by changing the following on line 398 of Cocos2dxActivity.java
from:
this.mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
to:
this.mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 8);
The stencil was disabled on the emulator for some reason (Iām not sure why). Setting the stencil buffer to 8-bit fixed the Scrollview appearing in green.
Oh, great find. Itās a relief to see this is specifically due to the simulator configuration, takes a lot off my mind.
I have these errors (green/black backgrounds) with android devices, one year ago. I use them on current projects without problem. Without editing java files.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 16, 8};
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
#endif
Just saying, this issue is still present on cocos2d-x 3.17, but this fix works.