我在论坛上搜索过这个,但没有找到类似的问题,好吧,所以我有一个自定义的列表视图,这个列表中的每个条目都是一个文本视图和一个图像。假设用户在某个活动中添加了文本,然后按下了保存按钮。当按下返回按钮返回此列表视图时。刚刚添加的条目应该从右侧滑入。我该怎么做,任何示例都会有所帮助。
问问题
779 次
2 回答
0
这是一个从下到上的工作示例,我想您可以将其转换为从右到左;-)
@Override
public View getView(int position, View convertView, ViewGroup parent) {
//Do the animation once.
if (position > maxposition) {
AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(400);
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(500);
set.addAnimation(animation);
row.startAnimation(set);
maxposition = position;
}
return row;
}
于 2012-09-08T08:05:43.693 回答
0
谢谢大家的贡献,我做了更多的挖掘,发现插值器为视图提供动画。参考了一个例子,实现了它并得到了我想要的。
于 2012-09-16T08:04:47.403 回答