我可以在模拟器中加载动画..它可以在任何真实设备上正常工作..
public class MainActivity extends Activity {
private ImageView imgView;
private Animation animation;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.grow);
animation.setRepeatCount(50); // Repeat animation infinitely
animation.setRepeatMode(Animation.REVERSE);
imgView = (ImageView) findViewById(R.id.imgView);
imgView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
imgView.startAnimation(animation);
new Handler().postDelayed(new Runnable() {
public void run() {
Intent it = new Intent(getApplicationContext(), MyWebView.class);
startActivity(it);
}
}, 5000);
}
});
}
我的 anim xml 文件如下
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:duration="50" />
最佳答案
我认为您可能在模拟器中禁用了动画: 检查:
设置>显示>动画..
希望对你的问题有所帮助
关于android - 动画在模拟器中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7358236/