Skip to main content

Posts

Showing posts with the label color

How to change status bar color in Sketchware?

Earlier code injection method was required for changing status bar color in sketchware. But now in newer versions of sketchware it can easily be done using  add source directly  block. To change the status bar color in sketchware project, insert add source directly block in onCreate event in LOGIC of the project, and then write the following code. Window w = this.getWindow(); w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); w.setStatusBarColor(Color.parseColor("#000000")); Change the hex color code in last line of the code as per the requirement. It will change color of status bar to the color code provided in the code above. This code has to be used on each screen of the app. Note that this code works in Android versions 5 and above. When the app is used in lower versions, it may crash the app. Therefore, we should use if..else.. to apply this code in compatible versions. So the code s...

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(getR...