android - 动画在模拟器中不起作用

标签 android animation android-emulator

我可以在模拟器中加载动画..它可以在任何真实设备上正常工作..

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/

相关文章:

android - 使用其组件名称找不到服务

java - Travis CI 上的 Retrolambda

Android:在 ListView 的每一行中水平显示 2 个 TextView

java - 处理丢失的连接插入

angularjs - ngAnimate 不在 ng-repeat 上添加动画类

javascript - animejs的时间间隔

android - 无法在 Android 模拟器上运行应用程序 : error message kvm is required to run AVD

animation - javafx如何在弹出窗口上添加动画

android - 每次启动 android 模拟器时是否应该需要 35 秒?

android - Android开发中使用logcat的基础知识