我使用了如下代码使一个图片实现移动:// 创建translate(位置变化)动画
Animation translateAnimation = new TranslateAnimation(0, 300,0, 0);
// 设置动画持续时间
translateAnimation.setDuration(3000);
// 开始动画
spaceshipImage.startAnimation(translateAnimation);移动是没有问题的,但是每次图片移动后都回到原来位置,假如想让它移动后停在新的位置,应该如何实现,谢谢!
Animation translateAnimation = new TranslateAnimation(0, 300,0, 0);
// 设置动画持续时间
translateAnimation.setDuration(3000);
// 开始动画
spaceshipImage.startAnimation(translateAnimation);移动是没有问题的,但是每次图片移动后都回到原来位置,假如想让它移动后停在新的位置,应该如何实现,谢谢!
解决方案 »
- google map报错
- android系统相机调用
- 初学者就碰到大问题而无法逾越就老鸟帮忙!
- 初学android,问下困扰了很久的问题。IPC方面
- android jni图片读取
- 右边两个按钮并排靠右,左边一个按钮填满其他空间 用了layout_width="0dp" layout_weight="1"就可以了,这两人个是什么意思呢?
- 【httpclient!!!】代理代理!!带验证的代理啊......
- android社交app用了哪些技术?
- 怎么把一个字符串转换成R.raw.xxx的格式,比如把“white”转换成R.raw.white的格式
- 关于对写的代码添加新功能的问题
- 请问路过的大神,3.0上如何显示menu键
- 如何使android应用不受横竖屏的影响
请问怎么不让他回到原来的位置呢?
translateAnimation.setFillAfter(true);
translateAnimation.setFillBefore(false);
已经搞定了,但是新问题出现了,如果连续移动的话(移动一次以上),控件会回到原来的位置,
请问怎么不让他回到原来的位置呢?
这个可以解决你的问题。。