Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add rounded corner to a drawable I'm using as a background in Android?

I have a specific drawable that I use as background in my app. It is not a solid color.
Now I want to add rounded corners to this drawable.

I only found the rounded corner available in a shape with a gradient or a solid color as a background but not another drawable.

Is there another easy way of adding rounded corners to a drawable?

like image 485
Janusz Avatar asked Jun 30 '10 15:06

Janusz


People also ask

How do I curve the edges of an image in Android Studio?

Create a layout and set its background to your shape drawable. Wrap that layout around your ImageView (with no padding) The ImageView (including anything else in the layout) will now display with rounded layout shape.

How do you rounded the corner of a TextView in Android?

xml file and add an attribute to that TextView, for which you want to add rounded corners. The attribute is android: background=”@drawable/rounded_corner_view”.


1 Answers

Use AQuery to make Drawable or Downloaded images rounded corners.

http://code.google.com/p/android-query/wiki/ImageLoading

Note : This is very effective in doing asynchronous task with images and provides lots of featres.

Download API from here : http://code.google.com/p/android-query/downloads/list

Code to do rounded Corners of an image :

AQuery aq = new AQuery(this);

// Image URL to download
String url = "http://www.vikispot.com/z/images/vikispot/android-w.png";

ImageOptions options = new ImageOptions();
options.round = 15;

aq.id(R.id.image).image(url, options);
like image 155
Munish Thakur Avatar answered Nov 01 '22 20:11

Munish Thakur