开发者

graph / widget / gauge / UI

开发者 https://www.devze.com 2023-03-22 10:55 出处:网络
I\'m trying to write an app that takes values form the accelerometer and displayes them via a bar gauge (or maybe needle gauge) but I\'m not to sure how to get the gauge to work. I was thinking of the

I'm trying to write an app that takes values form the accelerometer and displayes them via a bar gauge (or maybe needle gauge) but I'm not to sure how to get the gauge to work. I was thinking of these options:

  1. break the gauge into multiple parts and therefore multiple images, of the gauge "filling up" and depending on the values from the accelerometer, display a different image.

  2. Have just the one image of a full gauge and programmatically decide how much of the image to show. I dont fully understand how to do this but it seems to be a more elegant way of doing what I want as it means that I only need to have the one image that will be开发者_运维问答 manipulated and thus saving space.

I am confident that I can impliment the first option sucessfuly without too much hassle, but is it just taking the easy way out? Which of the 2 methods should I use? Is there another way to do this that I don't know about?

Any advice will be very much appreciated :)


If you are concerned about meeting a deadline, then doing what you are comfortable with is advisable; but, as you are exploring new techniques, #2 might be done by drawing a portion of the image, if the gauge is rectangular. Something fancier might be possible with a custom UI (that link looks like a fun and instructive activity, in any case).

0

精彩评论

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

关注公众号