I need a graphic needle pointer (like a speedometer, etc.) for my application, but such a user interface widget is not part of the SDK, so I probably need to create one myself.
My idea is to have a background with marks and colored fields (green, yellow, red) as one bitmap, and the needle as another bitmap drawn on top of the background but rotated at an appropriate angle.
In my book "Professional Application Development for Android 2" there is a somewhat similar example with the growth of the compass, although this picture is drawn using linear graphics, and not ready-made images, as I should use to get the desired look.
However, in the compass example, the entire canvas rotates before drawing labels. I cannot use this approach, since it will also rotate the background of the track. So I need to somehow rotate the needle image (which should be transparent) before overlaying it. But I do not know how to do this.
Can someone lead me in the right direction, how to continue acupuncture? Also, if there is a better way to build a counter than the sketch above, please let me know.
source share