Few codes to modify scrollbar in Sketchware

In Sketchware very limited modifications can be made to the scrollbar. Provided below are a few codes which work in Sketchware.

1. Make the scrollbar invisible
The scrollbar of Scrollview, ListView​, or Spinner can be made invisible by using following code in onCreate event by using add source directly block.

For vertical ScrollView:
vscroll1.setVerticalScrollBarEnabled(false);

For horizontal ScrollView:
hscroll1.setHorizontalScrollBarEnabled(false);

For ListView:
listview1.setVerticalScrollBarEnabled(false);

For Spinner:
spinner1.setVerticalScrollBarEnabled(false);

For WebView:
webview1.setVerticalScrollBarEnabled(false);
webview1.setHorizontalScrollBarEnabled(false);

Note that in this code vscroll1, hscroll1, listview1, webview1 and spinner1 are id of the Layout or widget inserted in VIEW area. This has to be changed according to the id of the Layout or widget whose scrollbar is to be removed.

2. Change position of scrollbar
The scrollbar can be positioned inside or outside overlay or inset using one of the codes provided below:

vscroll1.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
vscroll1.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
vscroll1.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
vscroll1.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET);

The id used has to be as per the id of Layout or widget.

Comments

Popular posts from this blog

A Flash Light App in Sketchware

Create Music Player app in Sketchware

Simple car racing android game in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Firebase auth in Sketchware for Login Activity