Ant*_*ton 6 android drawable android-animation
我像这样使用AnimationDrawable:
ImageView rocketImage = (ImageView) layout.findViewById(R.id.animation);
rocketImage.setBackgroundResource(R.drawable.progress_blue_animation);
rocketAnimation = (AnimationDrawable) rocketImage.getBackground();
rocketAnimation.start();
Run Code Online (Sandbox Code Playgroud)
此代码适用于Android 3.0/4.0/4.1/4.0,但在Android 2.2中不起作用.如何解决这个问题呢?
lhl*_*mgr 17
据我所知,这是2.1,2.2中的Bug
可能的解决方法可能是:
ImageView rocketImage = (ImageView) layout.findViewById(R.id.animation);
rocketImage.setBackgroundResource(R.drawable.progress_blue_animation);
rocketAnimation = (AnimationDrawable) rocketImage.getBackground();
rocketImage.post(new Runnable(){
public void run(){
rocketAnimation.start();
}
});
Run Code Online (Sandbox Code Playgroud)
(但我没有在目标> 2.1中尝试它)
归档时间: |
|
查看次数: |
3339 次 |
最近记录: |