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.

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

How to enable download in webview in Sketchware apps?

TextInputLayout in Sketchware

Create Stopwatch App in Android using Sketchware

How to integrate Admob Ads in Sketchware project using AIDE?

How to find and​ highlight a word in a text field in Sketchware?

Code for implementing Notifications in Sketchware

A Flash Light App in Sketchware

Create a Stopwatch App using Chronometer in Sketchware

Create app to save all passwords, protected using voice key