Listview和动画

| 我正在使用API​​ DEMOS的listview动画,示例2。这是OnCreate方法的代码段:
ListView listview = (ListView) findViewById(android.R.id.list);

AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(50);
set.addAnimation(animation);

animation = new TranslateAnimation(
    Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
    Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f);

animation.setDuration(200);
set.addAnimation(animation);

LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f);
listview.setLayoutAnimation(controller);
在将来的某个时候,将在列表的适配器上调用“ 1”,并且刷新了我的列表。但项目不再显示在动画中。 请帮忙。     
已邀请:
如果要在更改数据集后重新设置LayoutController的动画,请调用视图的方法startLayoutAnimation()。     
您应该检查该线程以了解notifyDataSetChanged()和notifyDataSetInvalidated()之间的区别(链接已更新为指向Romain Guy的答案!) 简而言之,区别是: * 2:更改数据集中的项目(添加/删除/更新/重新排序,无论如何)。
notifyDataSetInvalidated
:适配器的数据源不再可用。 在这里,您可以找到正在使用的具有
notifyDataSetInvalidated
功能的工作样本。也许它也会解决您的动画问题。     

要回复问题请先登录注册