【问题标题】:AnimationDrawables in bindView for custom ListView Adapters自定义 ListView 适配器的 bindView 中的 AnimationDrawables
【发布时间】:2011-12-08 03:04:39
【问题描述】:

我有一个自定义的ListActivity,它使用SimpleCursorAdapter 子类。在我的newView()bindView() 方法中,我试图根据数据库数据动态创建AnimationDrawable。 ImageViews 只显示第一个可绘制对象,并且不动画。

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

【问题讨论】:

    标签: android listview animation android-widget imageview


    【解决方案1】:

    你可以试试这个

    frameAnimation.setOneShot(false);
    

    有时应该是frameAnimation.stop();,然后是frameAnimation.start();

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-23
      • 1970-01-01
      • 1970-01-01
      • 2014-01-01
      相关资源
      最近更新 更多