design custom button in android code example

Example 1: design custom button in android

<?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>

Example 2: design custom button in android

android:src="@drawable/twitter"

Example 3: design custom button in android

android:background="@drawable/button_shape"

Tags:

Java Example