自定义视图中画布上的补间动画
我有一个扩展 View
的类,我在 onDraw() 方法中在其画布内绘制了我需要的所有内容,如下所示:
protected void onDraw(Canvas canvas) {
synchronized (this) {
float h = mHeight;
float w = mWidth;
canvas.drawColor(Color.WHITE);
float roadLine= (85.0f/100.0f)*h;
canvas.drawBitmap(mTop, 0, roadLine-mTop.getHeight(), null);
//this is what I'd like to animate
canvas.drawBitmap(mSmoke);
}
}
How do I make an Animation (tween动画)画在这里?
I have a class that extends View
, and I draw everything I need inside its canvas in the onDraw()
method, something like this:
protected void onDraw(Canvas canvas) {
synchronized (this) {
float h = mHeight;
float w = mWidth;
canvas.drawColor(Color.WHITE);
float roadLine= (85.0f/100.0f)*h;
canvas.drawBitmap(mTop, 0, roadLine-mTop.getHeight(), null);
//this is what I'd like to animate
canvas.drawBitmap(mSmoke);
}
}
How do I make an Animation (tween animation) draw in here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法在另一个类的
onDraw()
方法内绘制ImageView
。这可能更符合您的需求。
You can't draw an
ImageView
inside theonDraw()
method of another class.This is probably more what you're after.