Friday, September 27, 2019

Custom cricle button XML in Android

Today I will show you the custom cricle button xml in android in the simplest way, to use the custom cricle button, you must first search for the appropriate color code for your application.
You can refer to this article below.
Creat a cricle button Android
Step 1. Selecr color
#A86500
Step 2. Create file xml with custom_cricle_button.xml
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">
            <solid android:color="#eae1ff" />
            <corners android:radius="2dp"/>
            <padding
                android:bottom="0dp"
                android:left="0dp"
                android:right="0dp"
                android:top="0dp" />
            <size android:width="100dp"
                android:height="100dp"/>
        </shape>
    </item>
    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">
            <solid android:color="#A86500" />
            <corners android:radius="2dp"/>


            <padding
                android:bottom="0dp"
                android:left="0dp"
                android:right="0dp"
                android:top="0dp" />
            <size android:width="100dp"
                android:height="100dp"/>
        </shape>
    </item>
</selector>
Here is the result of custom button cricle xml in android :
Custom cricle button XML in Android

No comments:

Post a Comment