665 Size widgetSize =
_widget->getContentSize();
668 _displayValueLabel = Text::create(
"ScrollView InnerSize Test",
"fonts/Marker Felt.ttf", 32);
675 Text* alert = Text::create(
"ScrollView & InnerContainer should be align to the left and top point",
"fonts/Marker Felt.ttf", 10);
676 alert->setColor(Color3B(159, 168, 176));
677 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
680 Layout* root =
static_cast<Layout*
>(
_uiLayer->getChildByTag(81));
682 Layout* background =
dynamic_cast<Layout*
>(root->getChildByName(
"background_Panel"));
685 ui::ScrollView* scrollView = ui::ScrollView::create();
686 scrollView->setContentSize(Size(200.0f, 50.0f));
687 Size backgroundSize = background->getContentSize();
688 scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
689 (backgroundSize.width - scrollView->getContentSize().width) / 2.0f,
690 (widgetSize.height - backgroundSize.height) / 2.0f +
691 (backgroundSize.height - scrollView->getContentSize().height) / 2.0f));
692 scrollView->setScrollBarWidth(4);
693 scrollView->setTouchEnabled(
false);
694 scrollView->setScrollBarPositionFromCorner(Vec2(2, 2));
695 scrollView->setScrollBarColor(Color3B::WHITE);
696 scrollView->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
697 scrollView->setBackGroundColor(Color3B(150, 150, 100));
698 scrollView->getInnerContainer()->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
699 scrollView->getInnerContainer()->setBackGroundColor(Color3B(50, 100, 50));
700 scrollView->getInnerContainer()->setBackGroundColorOpacity(100);
701 scrollView->setClippingEnabled(
false);
704 scrollView->setInnerContainerSize(Size(250.f, 100.f));
cocos2d::Layer * _uiLayer
virtual bool init() override
cocos2d::ui::Layout * _widget