开发者

How easy would this be to implement? Creating a % to 100 bar

开发者 https://www.devze.com 2023-01-26 00:58 出处:网络
Let\'s say I random开发者_JAVA技巧ly generate a number 0 to 100.Where 0 is really cold and 100 is red hot.Wen the number hits, it would show an image bar (kind of like a % finished bar) that shows in

Let's say I random开发者_JAVA技巧ly generate a number 0 to 100. Where 0 is really cold and 100 is red hot. Wen the number hits, it would show an image bar (kind of like a % finished bar) that shows in the image what # you hit.

So it would kind of be like a progress bar from 0 to 100, and whatever # they hit it shows in the image of the bar in an imageview?


I describe a brute force tactic here, only use it if all else fails...

Get the length of the bar you want to color, multiply the length by the fraction of the number the user picked, result is the number of pixels that you should make the colored section of the bar.

so, your bar is 324 pixels, the user picked '42', 324 * .42 the length of the colored part of your bar is 136.08 pixels

0

精彩评论

暂无评论...
验证码 换一张
取 消