Skip to main content

Graphics and Animations Part 2 : ListView Animations

If you are using listviews in your app and using animations on click of the view then you must consider the fact that views are getsmrecycled in a listview. To say it simply, if the screen can show 10 items in a listiew at once , then there are 10 views are instantiated for that listview regardless of the total number of items. Thus when you scroll a listview, the views that goes off the screen are recycled and that reference is used to show views coming in the screen.

Thus understand that any animation you doing on a view may apply to other item if the listview is scrolled and that particular item goes out of stage. To avoid that you can chose two options according to the type of animation you are using. Below code demonstates that

Comments

Popular posts from this blog

Navigation drawer, material design theme

Aim: To make an android app with navigation drawer, material design theme Feat: Toolbar is used instead of the ActionBar, When the user runs the app for the time , he/she can see the drawer opened on the launch of the app, also rotation doesn't effect the drawer (whose layout is a fragment). Used: Fragments in both Code:   MainActivity.java ______________________________________________________________________________________________________ DrawerList.Java______________________________________________________________________________________________ package cts.fastester; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGr...