onDraw() 被调用了多少次?
我刚刚开始使用 android SDK,并尝试构建一个简单的气泡包装应用程序,这样我就可以了解自定义组件的工作原理。我有 onMeasure()、onSizeChanged()、onDraw() 方法,它们创建未弹出的气泡位图。我有一个 onTouchEvent() 所以我知道哪个气泡数字被触摸。之后,我想用破裂的气泡图像替换未破裂的气泡,并且想知道如何才能做到这一点。如果我理解正确的话, onDraw() 最初只被调用一次,对吗?
提前致谢!
I'm just starting to play around with the android SDK, and was trying to build a simple bubble wrap app, so I could understand how custom components work. I have my onMeasure(), onSizeChanged(), onDraw() methods which create the unpopped bubble bitmaps. I have a onTouchEvent() so I know which bubble number is being touched. After this I wanted to replace the unpopped bubble with a popped bubble image, and was wondering how I could go about doing that. If I understand it right, onDraw() is only called once initially right?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试重写 onDraw() 并使用 Log.D(tag,message) 写入日志消息。将未弹出的图像更改为弹出的图像并调用 postInvalidate()
Try override onDraw() and write a log message with Log.D(tag,message). Change the unpopped to popped image and call postInvalidate()