2011-08-31 3 views
2

내 xml 파일에 android : duration 속성에 문제가 있습니다. 이것이 내 코드입니다.AnimationDrawable 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> 

8 개의 이미지가 있습니다.

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(); 
} 
    } 

모든 것이 잘 작동하지만, 이미지 사이의 기간에 문제가 : 여기 내 활동 코드입니다. 안드로이드 : duration 속성에 어떤 숫자를 넣든간에 애니메이션은 매우 빠르게 실행됩니다. 누구가 문제가 있는지 아는 사람 있습니까?

은 기간이 "밀리 초"150입니다 의미하는 것은 매우 매우 빠르고에서 당신에게

답변

0

감사 (1500)은 1.5 초 150을 시도 넣어 두 번째

의 겨우 1 1/10 0.15 초를 의미 때 1500 또는 3000과 같은 수천의 숫자로 작동하는지 확인하십시오.

관련 문제