Skip to main content

Build a beautiful user interface in Sketchware

This tutorial will give you some tips to help you build a nice, professional looking interface in Sketchware. If you are still a new user, you might want to read this article on how to start building your interface in Sketchware.

We will cover:

1. Corner radii with gradient
2. Rounded corners
3. Adding shadow to a view
4. Add gradient and rounded corners

CORNER RADII WITH GRADIENT IN SKETCHWARE


Start by adding a linear to your layout. I have given my linear a width of 150 and a height of 150. 



I have added an add source directly block on my onCreate and I have typed in the following code:

android.graphics.drawable.GradientDrawable gd = new android.graphics.drawable.GradientDrawable(android.graphics.drawable.GradientDrawable.Orientation.RIGHT_LEFT,new int[]{ 0xFF6B32E1,//Top Color 0xFFA130E2 //Bottom Color }); gd.setCornerRadii(new float[] {0, 0, 0, 0, 0, 0, 390, 390 }); linear4.setBackgroundDrawable(gd);

ROUNDED CORNERS

If you want to add rounded corners to a widget like I have done in the image above, place the following code in your onCreate



android.graphics.drawable.GradientDrawable s = new android.graphics.drawable.GradientDrawable(); s.setColor(Color.parseColor("#FFCFD8DC")); s.setCornerRadius(25); linear4.setBackground(s);

You can change the colour code and the corner radius to make it even more round.


ADDING A SHADOW TO A VIEW



This feature elevates a view making it look 3 dimensional by creating a shadow around it. To add this, simply add the following code in an add source directly block:

linear1.setElevation(5f);

Linear 1 is the name or ID of the linear that we want to apply this to. This can be applied to a textview or other widgets as well. You can also change the number in brackets to increase or decrease the shadow.


ADD GRADIENT & ROUNDED CORNERS



The above image is a linear with a gradient made by two colours. This can be easily created using the code below. Simply place an add source directly block onCreate then add the following code.

android.graphics.drawable.GradientDrawable gd = new android.graphics.drawable.GradientDrawable(android.graphics.drawable.GradientDrawable.Orientation.RIGHT_LEFT, new int[]{ 0xFF009688, //Top Color 0xFF45C6A7 //Bottom Color }); gd.setCornerRadius(90f); linear4.setBackgroundDrawable(gd);

Please note that in the example above, you can change the colour by changing the color codes 0xFF009688 to your own color. To get the color codes you can click on a widget in Sketchware and then go to background color on the properties menu.


Comments

creativesuzi33 said…
Can I use a blue component "Toast" to add the code up for a colored corner?

Popular posts from this blog

Hip hop and RnB songs to apologize to your partner

Love is a beautiful thing, but it often goes wrong. This often leads to pain, suffering and sorrow.  Being imperfect beings, hearts tend to get broken all the time regardless how hard we may try to avoid it.  The heartbreak is often inadvertent but at times we find ourselves in the wrong. An oversight, a word unsaid or even a lapse in our judgement can cause our loved ones harm. This doesn't always have to be the end though. Oftentimes, relationships can be mended by simply uttering three simple words: "I AM SORRY". This article is a collection of some of my favourite 'I'm sorry' songs. I hope you'll enjoy these apology songs, but more importantly, I hope you will get a few quotables and some wisdom nuggets from them.  The best apology however, is to change behaviour (got that from a Jay Z interview) so as you apologize, please remember that it was your actions that hurt them. The best apology is one which involves you not repeating those same mistakes aga

How to easily create background notifications in Sketchware(original)

One of the keys to building a successful app is to find mechanisms that will keep your users engaged. You can do this by using background notifications. This tutorial will show you how to do that in Sketchware. We will cover: 1. How to create notifications in Sketchware 2. How to show these notifications even when the app is closed. We will start by creating a new project. If you do not know how to create a new project please check out this article here. Once we have created our project, let us create a more block to place our code. Navigate to the events menu and then to the moreblock section as shown in the image above. Create a moreBlock. I have created a moreblock with the name "BackgroundActivity" with a boolean variable named "run." See the image below for how to add the boolean variable. Place the following block in the moreBlock Background activity code: moveTaskToBack(_run); That will move our task to the background.  Please note, that at this point we have

Php date: How to get the first and last day of the week

In this tutorial, I'll show you how to get the first and last day of the week in php. By default, in PHP the week runs from Monday to Sunday. However we'll cover two methods to get the first and last day for both those who consider Sunday or Monday as their first day of the week. We will be using 2 functions to achieve this: date() strtotime() We will use a combination of these two functions and store the result in a variable.  How to get the first day of the week If you want to get Sunday, use this method: $firstday = date('l Y-m-d', strtotime("sunday -1 week")); echo $firstday; If you want to get the date for Monday, this current week, use this method: $monday = date('l Y-m-d', strtotime("monday -1 week ")); echo $monday; How to get the last day of the week The following code will give you Saturday as the last day of the current week. $lastday = date('l Y-m-d', strtotime("saturday 0 week")); echo $last