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

Post a Comment

Popular posts from this blog

Simple car racing android game in Sketchware

Creating a Drawing View in Sketchware

Enable Fullscreen for Youtube videos in WebView

How to enable upload from webview in Sketchware?

List of Calendar Format symbols valid in Sketchware