Skip to content Skip to sidebar Skip to footer

Android Programmatically Stroke

I want to draw a black stroke on my text in Android. I have seen this example: How do you draw text with a border on a MapView in Android? Where the solution overrides onDraw() to

Solution 1:

The simplest way to get a shadow for text rendered in a TextView is to set up a style as described in this answer. That requires very little work and sounds like it will work fine in your situation.

Using the technique you link to involves extending an existing View class, overriding onDraw(), and using Canvas.drawText() on the canvas passed to onDraw() to render the text yourself. That can be exactly what you need in some situations, but sounds like overkill for your current situation. If you want to look into it further, the Android dev guide on the subject is a good read.

Post a Comment for "Android Programmatically Stroke"