How can I draw circle through XML Drawable - Android?

AndroidAndroid LayoutAndroid Xml

Android Problem Overview


I'm trying to draw circle with the help of XML file in android, but circle is not displaying properly. Below code is showing Oval. How can I create circle in XML file.

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval"> 
    <gradient
        android:startColor="#FFFF0000"
        android:endColor="#80FF00FF"
        android:angle="45"/>
    <padding android:left="2dp"
        android:top="2dp"
        android:right="2dp"
        android:bottom="2dp" />
    <corners android:radius="10dip" />

</shape>

Any help would be appreciable.

Android Solutions


Solution 1 - Android

no need for the padding or the corners.

here's a sample:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >
    <gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF"
        android:angle="270"/>
</shape>

based on :

https://stackoverflow.com/a/10104037/878126

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVATSHALView Question on Stackoverflow
Solution 1 - Androidandroid developerView Answer on Stackoverflow