ListView entry load on slide slide and zoom animation implementation

Source: Internet
Author: User

To do this, you only need to animate the view of each entry before the adapter GetView.

First, you need 2 animated XML files.

Create a new Anim folder under Res: (Res/anim)

First animated XML file:

Up_from_bottom.xml

<?xml version= "1.0" encoding= "Utf-8"? ><set xmlns:android= "Http://schemas.android.com/apk/res/android"     android:shareinterpolator= "@android: Anim/decelerate_interpolator" >    <translate        android: Fromxdelta= "0%" Android:toxdelta= "0%"        android:fromydelta= "100%" Android:toydelta= "0%" android:duration= "        "/></set>

  

Down_from_top.xml

<?xml version= "1.0" encoding= "Utf-8"? ><set xmlns:android= "Http://schemas.android.com/apk/res/android"     android:shareinterpolator= "@android: Anim/decelerate_interpolator" >    <translate        android: Fromxdelta= "0%" Android:toxdelta= "0%"        android:fromydelta= " -100%" Android:toydelta= "0%"        android:duration= "/></set>"

  

Use the defined animations in the adapter for the ListView:

The code is as follows:

private int lastposition =-1; @Overridepublic view GetView (int position, view Convertview, ViewGroup parent) {    //load Your view, populate it, etc    ... View view = ...;    Animation Animation = animationutils.loadanimation (GetContext (), (Position > Lastposition)? R.anim.up_from_bottom:r.anim.down_from_top);    View.startanimation (animation);    Lastposition = position;    return view;}

  

Reference: Http://kylewbanks.com/blog/Implementing-Google-Plus-Style-ListView-Animations-on-Android

If you are interested the animation,

You can check out the full source on GitHub, or download the project and try it out.

ListView entry load on slide slide and zoom animation implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.