ui::ScrollView hide scrollbar

How can I hide a scrollbar or prevent it from showing?

Hey @kukuruzo91

I also played with properties of scroll in scrollView and it works fine for me.
I would recommend to check api first as it’s a straightforward thing or else show your implementation.

It’s a bad thing to ask 1 line question and expect a good answer unless it seems really genuine.

I had checked api first, but couldn’t find any appropriate methods. It is simple question for people who know the answer. I just need a method to do this. I don’t know how can help you my implementation, but will show a couple of lines:

`	scrollView = cocos2d::ui::ScrollView::create();
        scrollView->setContentSize(Size(headers->getContentSize().width, this->height - 2*headers->getContentSize().height));
	scrollView->setPosition(Vec2(0, headers->getContentSize().height));
        scrollView->setDirection(cocos2d::ui::ScrollView::Direction::VERTICAL);
        scrollView->setBounceEnabled(true);
        scrollView->setTouchEnabled(true);
        auto containerSize = Size(headers->getContentSize().width, height);
        scrollView->setInnerContainerSize(containerSize);

        scrollView->addChild(this->rowsContainer);
        commonContainer->addChild(scrollView);

`

You tried setScrollBarEnabled(false) ?

If it doesn’t work, you can try

scrollView->setScrollBarAutoHideEnabled(true);
scrollView->setScrollBarAutoHideTime()// Set time with minimal float value.

You tried this? setScrollBarOpacity

This all I got from api.

http://www.cocos2d-x.org/docs/api-ref/cplusplus/V3.11/d8/d29/classcocos2d_1_1ui_1_1_scroll_view.html#a617d903e7af7ecf03fb17b67b2920eda

I am not sure if you tried above all or whether they’ll help you achieve what you need. But I was asking if you tried any of the solution from your side or not! The code that you showed no where says that you don’t want to show scroll bar.
You said that it’s simple for the people who knows the answer. Fact is I myself checked the api. In my game, I’ve only used setScrollBarEnabled(true)… So, I don’t really know the answer.

1 Like

Thank you for your time and attention. I really appreciate it. I just watched another version of the api, that have not this functions, and yes this is my fail. ‘setScrollBarEnabled(false)’ - work for me.

Nice to know that. :slight_smile: