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