Tuesday, 15 February 2011

android - fade in/out listview header -



android - fade in/out listview header -

i'm trying implement fading header list view. need header fade out when listview beingness scrolled downwards , fade in when listview beingness scrolled up.

any suggestions?

thanks

goto yourproject-->res --> anim (make directory named anim) within create animation xml files fading in:

fade_in.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:fillafter="true" > <alpha android:interpolator="@android:anim/accelerate_interpolator" android:duration="800" android:fromalpha="0.0" android:toalpha="1.0" /> </set>

for fading out:

fade_out.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:fillafter="true" > <alpha android:interpolator="@android:anim/accelerate_interpolator" android:duration="800" android:fromalpha="1.0" android:toalpha="0.0" /> </set>

now load animations in activity:

myanimation1 = animationutils.loadanimation(getapplicationcontext(), r.anim.fade_in); myanimation2 = animationutils.loadanimation(getapplicationcontext(), r.anim.fade_out);

now phone call animation onbuttonclick or other event.

listviewheader.startanimation(myanimation1);

android android-listview android-animation

No comments:

Post a Comment