Thursday, March 28, 2013

Creating Round Shape || Android

In this post let's see how to create a round shape in Android.

1. To create round shape for first create a file called "circle.xml" in your drawable directory with the following content. 

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF" android:angle="270"/></shape>
2. Now create a view which sets this circle as drawable 

<View android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/circle"/>
3. Now you can place this view anywhere in your layout.