2011-12-08 20 views
0

SimpleCursorAdapter 서브 클래스를 사용하는 사용자 정의 ListActivity이 있습니다. 내 newView()bindView() 방법에서는 데이터베이스 데이터에 따라 AnimationDrawable을 동적으로 만들려고합니다. ImageViews는 첫 번째 드로어 블만 표시하고 애니메이션을 적용하지 않습니다.AnimationDrawable 사용자 정의 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();

관련 문제