Sunday, January 11, 2015

How to create a round/circle Button in Android

activity_main.xml code snippet

<Button
 android:id ="@+id/push_button"
 android:layout_width="150dp"
 android:layout_height="150dp"
 android:text="Round Button"
 android:background="@drawable/button_bg_round"
 android:padding="15dp"
 />
res/drawable/button_bg_round.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <stroke android:color="#1E90FF" android:width="5dp" />
            <solid android:color="#87CEEB"/>
            <size android:width="150dp" android:height="150dp"/>
        </shape>
    </item>
</selector>
More android examples