开发者

How to graphically represent numerical data in Android

I am trying to show a graphical repre开发者_JAVA技巧sentation of how far away a person is from a fixed point using GPS on an Android phone.

I have done all the working out of the distance away; for argument's sake lets say the distance is double distanceAway.

I imagine the code would be similar to the code that controls a health bar in a game but I have no idea.

I would like to represent the distance as a thermometer that gets "hotter" as the user gets closer to the destination.

(Apologies for the vagueness of the title, but I'm new to android programming and wasn't entirely sure what a suitable title for this post should be.)


Use a ProgressBar that fills up the closer you reach your target. You can search Google for tips on how you can customize the color of the ProgressBar as it fills up. You can set the progress level from code, so once the user reaches a threshold (like maybe 50 meters away) you can start filling up the progress bar.

You can also do it the other way: Progress bar starts filled up and level decreases as you get nearer your target.

As your question is so vague, I'm not really sure now if this helps at all.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜