自定义视图的onDraw被不断呼吁 [英] Custom View onDraw is constantly called
本文介绍了自定义视图的onDraw被不断呼吁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有我重写的onDraw方法使用画布绘制位图的自定义视图。
I have a custom view which I override the onDraw method to draw bitmaps using the canvas.
我真的不能发布任何code,因为其相当漫长而复杂的。
I can't really post any code because its quite long and complicated.
我把日志中的onDraw方法,我看到它从未停止被调用。
I put a log in the onDraw method, and I see that it never stopped being called.
我的问题是,什么都可以触发的onDraw方法调用除外无效的视图或它的祖先?
My question is, what can trigger the onDraw method except calling invalidate on the view or its ancestors?
推荐答案
中发现的问题。我叫的getWidth()和getHeight()
在的onDraw()
法
found the issue. I called getWidth() and getHeight()
in the onDraw()
method
这篇关于自定义视图的onDraw被不断呼吁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文