【问题标题】:Animation is not working in Emulater动画在模拟器中不起作用
【发布时间】:2011-09-09 07:06:39
【问题描述】:

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

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 animation android-emulator


【解决方案1】:

对于在使用ObjectAnimator 时遇到类似问题的任何人,在我的情况下,我必须在模拟器上启用开发人员设置,然后进入“设置”>“开发人员选项”>“绘图”部分

在这个“绘图”部分,您会发现每种动画类型的不同选项,在我的例子中,“动画器持续时间比例”已关闭,在将其设置为“1x”后,我开始在模拟器上看到动画。

【讨论】:

    【解决方案2】:

    我认为您可能在模拟器中禁用了动画: 检查:

    设置>显示>动画..

    希望对您的问题有所帮助

    【讨论】:

    • 我检查了..但它已经打开了..m 得到了三个选项“无动画”、“一些动画”和“所有动画”......在“所有动画”中选择了它......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 2017-01-19
    • 2017-01-05
    • 2013-03-11
    • 2019-09-07
    • 2012-07-01
    • 1970-01-01
    相关资源
    最近更新 更多