10
我想动画列表视图的项目。目前,我正在应用添加新项目时列表项目上的Transition Animation。但这不是我想要实现的动画。我希望在列表视图中添加新项目时,整个列表视图会移动一个位置,让新添加的项目让位。将动画添加到Android中的列表视图
目前我使用的代码是:
set = new AnimationSet(true);
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(150);
set.addAnimation(animation);
LayoutAnimationController controller = new LayoutAnimationController(set, 1.0f);
l.setLayoutAnimation(controller);
l.setAdapter(listAdaptor);
然后同时通过按钮添加项目的onClick
l.startLayoutAnimation();
任何其他建议实现这样的动画。
我在'R.anim.slide_top_to_bottom'找到错误anim无法解析或不是字段 – Nishant 2012-05-24 05:52:56
您是否在文件夹中添加xml? – ASH 2012-05-24 06:27:17
不可以你给那个文件的代码吗? – Nishant 2012-05-24 07:06:20