How to define a circle shape in an android xml drawable file

Please follow and like us:

Circle Shape in android xml drawable file

This tutorial is about to explain, how to use <Shape> </Shape> for making circle shape drawable background for any android views.

Let’s see example of circle shape in an android xml drawable file

create circle.xml file in drawable folder and put following things in it.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <!-- Add Color for background-->
    <solid android:color="#ffffff" />
    <!-- Add Color and width for border-->
    <stroke

        android:width="1dp"
        android:color="#ccc" />
    <!-- add radious for rounded shape-->
    <corners
        android:bottomLeftRadius="2dp"
        android:bottomRightRadius="2dp"
        android:topLeftRadius="2dp"
        android:topRightRadius="2dp" />
</shape>

Hope you liked our “circle shape in an android xml drawable file” tutorials, thanks. Keep in touch with our blog for upcoming latest Android Development tutorials.

nirav kalola