Android, Designing custom Button (gradient and animation)
In my application I want to apply gradient to Button. I have written following code and the result is perfect.
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<padding
android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp"/>
<solid
android:color="#FF000000"/>
</shape>
</item>
<item>
<shape>
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp"/>
<gradient
android:startColor="#FFB0B0B0"
android:centerColor="#FFFFFFFF"
android:endColor="#FFB0B0B0"
android:angle="315"/>
<corners
android:radius="3dp"/>
</shape>
</item>
</layer-list>
But my problem is, when I click on this button I have no effect or animation such as original one. Therefor, I want to add some effect on it t开发者_运维百科hat when user clicks on it the button becomes bigger and when released the key, the button comeback to its situation.
guide me please. thanks :)
This is for only background of button but you have not specified anything for different events like click, hover, etc.
For that you have to create another set of styles and set them in selector as in my previous answer and make that selector as background of your button
精彩评论