做一个textitem用颜色填充根据时间 [英] Make a textitem fill with color according to the time

查看:104
本文介绍了做一个textitem用颜色填充根据时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有可能有一个TextView(或类似的东西),并使其与根据时间颜色填充。例如,如果该时间为7:30,将有一个8号填充中途有颜色。在7:35将它一点点填补。我从来没有见过任何Android应用程序的想法是这样,所以我不知道,如果它甚至Android SDK的支持。我将不得不求助于使用图像和视时的画面?更改

I was wondering whether it would be possible to have a textview (or something similar), and make it fill with color depending on the time. For example, if the time was 7:30, there would be a number 8 filled halfway with color. At 7:35 it would be filled a little bit more. I've never seen an idea like this in any android app, so I'm not sure if it's even supported by the android SDK. Would I have to resort to using images and change the picture depending on the time?

与此类似:

something similar to this:

推荐答案

是它肯定是可能的。

您可以使用图像作为你所提到的,有两个图像 - 一个是满刻度的黑色,另一种是具有某种的定时器或与动画的属性动画

You can either use images as you mentioned, have two images - one is full scale black, and the other is an image slowly revealing with the help of some kind of Timer or animation with Property animation.

其他可能的方法是绘制位上的画布。在这种情况下,你会ofcourse必须使用所需的字体,然后借鉴画布上的文字。那么你可以用画布大小发挥创造偏色的效果。

The other possible way is drawing the digit on a canvas. in that case you'll ofcourse have to use the desired font, and then draw the text upon the canvas. then you can play with the canvas size to create the effect of partial color.

这篇关于做一个textitem用颜色填充根据时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆