0
我想創建一個動畫可繪製,它只會有兩個框架和循環在屏幕上。Android動畫可繪製的創建和循環
但是,由於某種原因,我的Animationdrawable沒有做,甚至一個圓形,只是顯示第一幀,更不用說循環...
這裏是我的代碼:
Handler handler = new Handler();
AnimationDrawable mouseani = new AnimationDrawable();
ImageView img;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Drawable mouse1 = getResources().getDrawable(R.drawable.mouse_for_use);
Drawable mouse2 = getResources().getDrawable(R.drawable.mouse_for_use_2);
mouseani.addFrame(mouse1, 500);
mouseani.addFrame(mouse2, 500);
img = (ImageView) findViewById(R.id.imgView);
img.setBackgroundDrawable(mouseani);
mouseani.setCallback(img);
mouseani.setVisible(true, true);
mouseani.start();
mouseani.stop();
}
謝謝!