[android-developers] Re: Android ListView Animation
Try a different trick... instead of assigning the animation to the whole list view (which works fine as a Layout Animation) try doing the animation per view on each call of getView.
Since the dataset changes, getView will be called for each of the visible views.. have each view animate itself out of view, replace the data with the new data and then animate in. You'll probably have to use onAnimationEndListener for doing the actual data replacement (on the animation out)
On Saturday, December 8, 2012 8:07:29 AM UTC-5, Makrand wrote:
-- On Saturday, December 8, 2012 8:07:29 AM UTC-5, Makrand wrote:
I am trying to add Animation for ListView I am using getView()to draw some views in list. all works fine.public View getView(int position, View convertView, ViewGroup parent) { }I am trying to add animation when user click on list cell then all list cells should slide left and new data should come from right at same time, means cell data is moving towards left and same time new data coming from right side.I Have implemented following code in OnItemClickListener@Overridepublic void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {Animation slideOutAnimation=AnimationUtils.loadAnimation( this, R.anim.slide_out); slideOutAnimation.setDuration(900); Animation slideInAnimation=AnimationUtils.loadAnimation( this, R.anim.slide_in); slideInAnimation.setDuration(500); listView.startAnimation(slideOutAnimation); new Handler().postDelayed(new Runnable() {@Overridepublic void run() {data = newData();listView.startAnimation(slideInAnimation); myAdapterClass.notifyDataSetChanged(); }}, slideOutAnimation.getDuration()); }};above code is working but not getting desire output I am getting one empty view while changing Animation.Left Sliding Animation Starts--- Empty View----Right Sliding Animation StartsNot getting why Empty view (shows empty screen for while) is coming, I have played with Animation time and handler but no luck.How to remove that empty view ? how to achieve this output ?Left Sliding Animation Starts(Data moving)( Same time data coming from Right) Right Sliding Animation Starts
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home