Friday, September 27, 2019

How to custom Button Gradient in Android

Hello everyone today, I will show you how to custom button gradient in android in the simplest way, currently the most commonly used button in android in the app because its feature will help you make the event.
custom Button Gradient in Android

Create file xml in folder drawble custom_button_gradient.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" >
        <shape android:shape="rectangle" >
            <solid android:color="#4491BB" />
            <gradient
                android:startColor="#3CFF00"
                android:centerColor="#7AFF51"
                android:endColor="#9D00A8"
                android:angle="90"/>

        </shape>
    </item>
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#505C89A2" />
            <gradient
                android:startColor="#5033ACCB"
                android:centerColor="#5074C6DC"
                android:endColor="#50D651FF"
                android:angle="90"/>
        </shape>
    </item>
</selector>
This is the result of implementing custom button gradient in android with the image below:

How to custom Button Gradient in Android

No comments:

Post a Comment