【问题标题】:Android graphics: How does TransitionDrawable work?Android 图形:TransitionDrawable 是如何工作的?
【发布时间】:2011-06-18 21:21:17
【问题描述】:

我阅读了文档,但无法进行转换。事件的流程应该是什么样的?谁叫谁?

假设我想要一个调用 init() 的活动来绘制线 a,并调用 go 进行 5 秒的过渡到线 b。我需要对这段代码做什么?

public class Fun extends View
{
    Drawable a;
    Drawable b;
    TransitionDrawable t;
    public Fun(Context context) 
    {
        super(context);
        a = new LineA();
        b = new LineB();
        Drawable ray[] =  {a,b};
        t = new TransitionDrawable( ray );
    }

    @Override
    protected void onDraw(Canvas canvas)
    {
        t.draw(canvas);

    }

    public void init()
    {
        t.resetTransition();
    }

    public void go()
    {
        t.startTransition(5000);
    }

谢谢!

【问题讨论】:

    标签: android animation graphics view drawable


    【解决方案1】:

    回答我自己的问题:

    不适用于View,扩展类必须是ImageView。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-15
      • 2012-06-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多