Android: using 9-patch and text for ItemizedOverlay on MapView
In my application I would like to mark different spots on a map. What I'm now wondering is if there's a way to use a simple 9-p开发者_StackOverflowatch image and add the spot's name as text to it or would I need to draw everything myself (including the text) in the draw()
method of ItemizedOverlay
?
As per this Q&A:
Drawing Nine Patch onto Canvas (Android)
you should be able to load the 9-patch using Resources.getDrawable, set the drawing bounds using Drawable.setBounds, and finally draw to the canvas provided in onDraw
using Drawable.draw.
If you plan on reusing the drawable, you should keep an eye out for memory leaks, per this article.
精彩评论