动画数字变化
我想构建一个组件,能够以旧模拟汽车计数器的风格显示最多 5 位的整数,并以动画方式显示数字变化。
看起来像这样也许...
我尝试过搜索这种示例,但找不到到目前为止的任何事情。
您认为实现这一目标的最佳方法是什么?
我查看了 iPhone 闹钟时间选择器,据我所知,只有固定的背景,它们将数字推入或推出视图。但在这种情况下我如何放置数字并将它们引用到特定值?
tnx。
i want to build a component that will be able to show a integer number max 5 digits in the style of the old analog car counters and animate the digit change.
that looks something like this maybe...
i have tried searching for this kinda of examples but i couldn't find anything so far.
in your opinion what is the best approach to achieve this?
i looked at the iphone alarm time picker and as far as i can tell there is only a fixed background and they push the numbers in or out the view. but how do i place the digits in this case and reference them to a particular value?
tnx.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试创建自己的视图,扩展视图并重写 onDraw()。
在这里,您可以使用位图中的数字行,并根据您希望显示的数字编辑它们的位置。
设置新数字后不要忘记调用 invalidate() 来重绘视图。
我将粘贴一个包含项目开始的示例。
位图编号是一个垂直图像,编号为 1-9(以及 0&.)
。
You can try to create your own view, extending view and overriding onDraw().
Here you can use rows of numbers in bitmaps and editing their position based on the number you wish to show.
Dont forget to call invalidate() after setting new numbers to redraw the view.
I will paste an example containing a start for your project.
The bitmap number is a vertical image with numbers from 1-9 (and 0&.)
Ex.