button - Android pop in animation -
i mave floating action button in app want sort of pop in, invisible , starts grow size 60dp , resizes normal size of 56dp. how can done? know how normal fade in animation, not pop in.
i create animation file in res/anim , use sequential scale animation so:
expand_in.xml
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:fromxscale="0.0" android:fromyscale="0.0" android:toxscale="1.1" <!--set scale value here--> android:toyscale="1.1" android:pivotx="50%" android:pivoty="50%" android:duration="400"/> <!--length of first animation--> <scale android:fromxscale="1.1" <!--from whatever scale set in first animation--> android:fromyscale="1.1" android:toxscale="1.0" <!--back normal size--> android:toyscale="1.0" android:pivotx="50%" android:pivoty="50%" android:startoffset="400" <!--start 2nd animation when first 1 ends--> android:duration="400"/> </set>
then in activity:
animation expandin = animationutils.loadanimation(this, r.anim.expand_in); actionbutton.startanimation(expandin);
Comments
Post a Comment