2011-12-08 15 views
0

SimpleCursorAdapterサブクラスを使用するカスタムListActivityがあります。 newView()bindView()のメソッドでは、データベースのデータに応じて、AnimationDrawableを動的に作成しようとしています。 ImageViewsは最初のドロウアブルのみを表示し、アニメーション化しません。アニメーションカスタムListViewアダプタのbindViewでのドローイング

@Override 
public void bindView(View v, Context context, Cursor c) { 
    Resources res = context.getResources(); 

    Drawable frame1 = null; 
    if(tt.getDrawable() != null) frame1 = res.getDrawable(tt.getDrawable()); 

    ImageView icon = (ImageView) v.findViewById(R.id.idt_icon); 

    AnimationDrawable transition = new AnimationDrawable(); 
    transition.addFrame(frame1, 500); 
    transition.addFrame(res.getDrawable(R.drawable.sunny_thought), 1000); 
    transition.start(); 
    icon.setImageDrawable(transition); 

答えて

1

あなたはそれがframeAnimation.stop();する必要があり、時々この

frameAnimation.setOneShot(false); 

を試すことができ、その後、frameAnimation.start();

関連する問題