Posts

Showing posts with the label Imageview​with rounded borders in Sketchware

Create Imageview with rounded corners in Sketchware

Image
To create an ImageView showing image with rounded corners follow the steps given below. 1. In your Sketchware android project, add an ImageView imageview1 , and set your desired image in imageview1. 2. In LOGIC area of your project, in onCreate event, add two add source directly blocks. 3. In the first add source directly block , add the following code which creates a bitmap image from imageview1. Bitmap bm = ((android.graphics.drawable.BitmapDrawable) imageview1 .getDrawable()).getBitmap(); 4. Then apply class getRoundedCornerBitmap(Bitmap, int) to round the corners of bitmap image, and then set it as image of imageview1, using following code in the same block. imageview1 .setImageBitmap(getRoundedCornerBitmap( bm , 360 )); Note that in above code, imageview1 is id of Imageview and it should be changed as per the id of your Imageview. The underlined text 360 is the extent to which the corners are rounded. It can be changed between 0 and 360 as per the requireme...