Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android AnimationDrawable持续时间属性_Android_Android Animation - Fatal编程技术网

Android AnimationDrawable持续时间属性

Android AnimationDrawable持续时间属性,android,android-animation,Android,Android Animation,我的xml文件中的android:duration属性有问题。 这是我的代码: <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:drawable="@drawable/eye_1" android:duration="150" /> <item . . . </animation-l

我的xml文件中的android:duration属性有问题。 这是我的代码:

<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item
android:drawable="@drawable/eye_1"
android:duration="150" />
<item
.
.
.
</animation-list>
一切正常,但图像之间的持续时间存在问题。无论我在android:duration属性中输入什么数字,动画运行速度都非常快。有人知道哪里有问题吗

谢谢

持续时间以“毫秒”为单位,表示150非常快 当1500是1.5秒,150是0.15秒,刚好超过十分之一秒

试着把一个数字以千为单位,比如1500或3000,看看这是否有效。持续时间以“毫秒”为单位,这意味着150非常快 当1500是1.5秒,150是0.15秒,刚好超过十分之一秒

试着把一个数字以千为单位,比如1500或3000,看看这是否有效

    public class MyActivity extends Activity {
    AnimationDrawable frameAnimation;
    private MediaPlayer mp;
    @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sauron);
        mp = MediaPlayer.create(this, R.raw.sound);
        mp.setLooping(true);
        mp.start();

        ImageView imgView = (ImageView) findViewById(R.id.animationImage);
        // imgView.setVisibility(ImageView.VISIBLE);
        imgView.setBackgroundResource(R.drawable.animation);

        frameAnimation = (AnimationDrawable) imgView
                .getBackground();


     // Get instance of Vibrator from current Context
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(10000);
    }
    @Override public void onWindowFocusChanged(boolean hasFocus) { 
        frameAnimation.start(); 
        super.onWindowFocusChanged(hasFocus); }

@Override
    protected void onStop()
{
    // Stop play
    super.onStop();
    mp.stop();
}
    }