Create custom button in Android using XML


How to create custom button in android using xml style file . which is placed on drawable folder .

Now, just create shape of the ImageButton to have black shader background.
android:background="@drawable/button_shape"
and the button_shape is the xml file in drawable resource:

    <?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="#505050"/>
<corners
android:radius="7dp" />

<padding
android:left="1dp"
android:right="1dp"
android:top="1dp"
android:bottom="1dp"/>

<solid android:color="#505050"/>

</shape>

Happy Coding!!!
Create custom button in Android using XML Create custom button in Android using XML Reviewed by D Kshetri on 9:40 PM Rating: 5

No comments:

Powered by Blogger.