Rabu, 18 Oktober 2017

How to change color of Seekbar, Checkbox, and Switch in Sketchware?



The color of various widgets can be changed programmatically with simple codes. Provided below are a few codes which can be used in Sketchware to change the color of Seekbar, Checkbox and Switch.

Codes for Seekbar
To change color of Seekbar progress and Seekbar thumb use the codes provided below in add source directly block in onCreate event.

seekbar1.getProgressDrawable().setColorFilter(Color.parseColor("#FF00FF"), PorterDuff.Mode.SRC_IN);

seekbar1.getThumb().setColorFilter(Color.parseColor("#FF00FF"), PorterDuff.Mode.SRC_IN);

Note that in the code above seekbar1 is the name or id of the Seekbar inserted in VIEW area.

The Seekbar thumb can be made invisible by using 00 for AA in code #AARRGGBB in color code. So code for no thumb may look like:
seekbar1.getThumb().setColorFilter(Color.parseColor("#00FF00FF"), PorterDuff.Mode.SRC_IN);


We can also use an image as Seekbar progress and Seekbar thumb, by using following code:

seekbar1.setProgressDrawable(getResources().getDrawable(R.drawable.submit));

seekbar1.setThumb(getResources().getDrawable(R.drawable.i_black));

Note that in this code 'submit' and 'i_black' are name of images being used. The images have to be added using image manager, before using this code.

Codes for Checkbox
To change color of Checkbox button use the codes provided below in add source directly block in onCreate event.

checkbox1.getButtonDrawable().setColorFilter(Color.parseColor("#FF00FF"), PorterDuff.Mode.SRC_IN);

Note that here checkbox1 is id of the Checkbox widget inserted in VIEW area (xml).

Codes for Switch
To change color of Switch use the codes provided below in add source directly block in onCreate event.

switch1.getTrackDrawable().setColorFilter(Color.parseColor("#FF00FF"), PorterDuff.Mode.SRC_IN);

Note that here switch1 is id of the Switch widget inserted in VIEW area (xml).
Share:

1 komentar:

  1. Tahu cara buat spinner fontnya bisa dirubah ukuran/warnanya? Tlg sharing dong. Trimakasih byk

    BalasHapus

Alam terbuka mengasyikkan di Destinasi impian

Jasa Pembuatan Website Archives - Legenda Web

loading...

Archive

Cari Blog Ini

Diberdayakan oleh Blogger.

Mengenai Saya

Foto saya
Saya memiliki Jasa Pembuatan Website Terpercaya
www.legendaweb.com

Pernah mengerjakan seo untuk Agen Travel door to door ecopremieretransindo.com dan Agen Travel Jakarta Jogja jakjogtrans.com

Juga memegang SEO Biro jasa paspor

Selain Itu, kerjasama dengan Sewa Mobil Bali Mai Bali Trans dan Industri pariwisata trip Bali dari beautrip.id

Labels

Admob ads in Sketchware Admob Ads in Sketchware App admob ads using AIDE Admob banner ads using AIDE Admob interstitial Ads Android app Android change status bar color animation in Sketchware background music Change color of checkbox in Sketchware change color of Seekbar change color of Switch button change status bar color code for moving image with finger in android code Injection create and share text file in Sketchware create text file in Sketchware Custom listview in android Custom ListView in Sketchware CustomView in Sketchware Dictionary Android App Dictionary Android project Dictionary App Dictionary App in Sketchware drag image enable download from Sketchware enable download in webview enable download without code Injection Enable image upload enable upload from webview enable upload from webview in android enable upload in Sketchware enable upload in webview​ using AIDE enable upload using AIDE gif image in Android App gif image in webview how to use ListView in Sketchware how to use Spinner image zoom Integrate Admob Ads in Sketchware Intent large paragraphs in Sketchware larger texts in Edittext. limit input text length load image in webview make image fit screen make scrollbar invisible media player move image with finger notification icon in Android notification in Android Notifications in Sketchware open other apps retrieve APK file retrieve source code share button share button in Android App share button in Sketchware App Share text file Sketchware sound on off sound play pause soundpool Soundpool for Multiple sounds Sounds in Android App stopwatch Android App Stopwatch App string list timer use of list