首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android逐帧动画怎么让动画停在最后一张

2012-09-03 
android逐帧动画如何让动画停在最后一张我运行后每次运行完后发现动画都停在第一张,而不是最后一张,再问个

android逐帧动画如何让动画停在最后一张
我运行后每次运行完后发现动画都停在第一张,而不是最后一张,再问个问题android:enable="false"是否有这个我想把编辑框变为不可编辑的,包提示没这个

[解决办法]
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
增加android:oneshot="true"属性, 会停留在最后一帧

你说的编辑框是指的EditText么, 可以设置android:editable="false"使之不可编辑


[解决办法]
贴点代码拜
官网说明:http://developer.android.com/guide/topics/graphics/drawable-animation.html
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/rocket_thrust1" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust2" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust3" android:duration="200" />
</animation-list>
This animation runs for just three frames. By setting the android:oneshot attribute of the list to true, it will cycle just once then stop and hold on the last frame.
(设置android:oneshot="true"后动画只执行一次, 并且停留在最后一帧)
我用的没问题哇...
[解决办法]
我认为不是布局方面的问题,猜可能楼主的代码中调用这个动画的组件可能有设置了图片路径
[解决办法]
drawable 当前帧引用的drawable资源 
duration 当前帧显示的时间(毫秒为单位) 
oneshot 如果为true,表示动画只播放一次停止在最后一帧上,如果设置为false表示动画循环播放。 
variablePadding If true, allows the drawable’s padding to change based on the current state that is selected. 
visible 规定drawable的初始可见性,默认为flase; 
你可以在程序里控制
boolean isOneShot() 

Void setOneShot(boolean oneshot)
 获取oneshot属性
设置oneshot属性

热点排行