0

For Android / TextView,

Is there a way to have a shadow for the text but not to draw the shadow under transparent text? (it's easy achievable in iOS)

Look at the picture below. We can see the shadow through transparent text, so the text color is not the same - in some place it is darker, in other places - lighter.

enter image description here

Desired output - equal transparent text color, shadow is not visible under the text (it should look as when you prepared an image of non-transparent text with shadow, and then you programmatically changed Alpha of whole picture, so in result there is no shadow under text):

enter image description here

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Anton
  • 2,846
  • 1
  • 10
  • 15
  • Are you asking for that? https://stackoverflow.com/questions/2486936/android-shadow-on-text or I don't understand your question. – Marc Estrada May 20 '18 at 07:38
  • 1
    you can do that, but it is not available directly - you need to extend `TextView`, override `onDraw` method and use `porter duff` stuff to make your custom drawing – pskink May 20 '18 at 07:41
  • @pskink, thank you! Yes, I was thinking about that (I used porter duff for Color Filters in the past), but I thought there is better (native) and easy way or option. – Anton May 20 '18 at 07:56
  • @MarcEstrada, I know how to set Shadow and transparent color for the text, but I don't like blending mode applied for shadow/text. When I apply transparency for the text, I want to see other elements, excluding its own shadow. I hope it makes sense now. – Anton May 20 '18 at 08:05

0 Answers0