Sunday, November 11, 2018

selectable button in android studio | click a button show hovor in android studio

Today I will discuss about android studio button selection. How we can use a hover effect in this button. .

here the code , you use this code snap to your drawer folder and give a name as you want.
then you use this as a background in your button which is stayed in layout section.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="40dp"></corners>
<size android:width="200dp" android:height="50dp"></size>
<gradient android:centerColor="#FB9491" android:endColor="#FC73C4" android:startColor="#FAC943"></gradient>
</shape>
</item>
<item android:state_pressed="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="40dp"></corners>
<size android:width="200dp" android:height="50dp"></size>
<stroke android:width="1dp" android:color="@color/color_divider"></stroke>
</shape>
</item>
</selector>


thanks , I will talk to you another topics later.