Tuesday, 30 April 2013

Button click effect

res/anim/clickeffect.xml
 
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false" >

    <set android:interpolator="@android:anim/decelerate_interpolator" >
        <scale
            android:duration="100"
            android:fillBefore="false"
            android:fromXScale="0.8"
            android:fromYScale="0.8"
            android:pivotX="40%"
            android:pivotY="40%"
            android:startOffset="300"
            android:toXScale="0.8"
            android:toYScale="0.8" />
    </set>

</set>

In Onclick event of the button 

add the following code inside the onclick function 
 
Animation hyperspaceJump = AnimationUtils.loadAnimation(context, R.anim.clickeffect);

No comments:

Post a Comment

Disqus for Android