I am trying to programmatically draw a parking icon to place as the drawable for an itemized overlay on a map.
The icon consists of a blue square with a white 'P' in its centre of which I would like to programmatically change the colour of the square to denote different parking types.
I've tried creating it via the canvas using drawRect & drawText but I cannot find a simple way of centering the text in the square and I cannot find a way to center the canvas on the coordinates - it keeps wanting to anchor from the top left hand corner.
I've alternatively tried creating an XML layout to convert to a drawable but cannot achieve this either.
Is there an elegant solution for what I am trying to achieve?
Make several png images & put them in
res\drawable
, if you have more than like 5 colors then think about using less. It's confusing for the user.