Make a layout with rounded corners in sketchware



1) Create a new sketchware project.

2) Drag and drop a Linear layout with id linear1.

3) Add a widget that you want make a rounded corners inside Linear Layout linear1. It may be EditText or Button or TextView or ImageView, etc.

5) Add a new more block round with View view , string color ,string stroke_c and a number radius.

6) Paste the below code to the more block :-

android.graphics.drawable.GradientDrawable gd = new android.graphics.drawable.GradientDrawable();

gd.setColor(Color.parseColor(_color));
gd.setCornerRadius((float)_radius);
gd.setStroke(2, Color.parseColor(_stroke_c));

_view.setBackground(gd);

7) In onCreate event add the more block with your view, colour, stroke colour and radius.

Thank you...

Comments

  1. Like other of your posts, Pics will be handy

    ReplyDelete
  2. Please can we enter the colour names using their conventional forms like blue or green or do we have to enter them using hex codes like #2678BE

    ReplyDelete

Post a Comment

Popular posts from this blog

How to zip files in Sketchware

Screen Recorder in Android Studio