0

I have a problem with setting a shadow to TextView as it seems it doesn't work on all devices. I am currently doing it like this:

myTextView.setShadowLayer(0.5f, 2.0f, 2.0f, Color.BLACK);

It works great on some devices but on some it doesn't appear at all. What could be a problem with this simple code? Thank you.

user4386126
  • 1,205
  • 5
  • 17
  • 32

1 Answers1

0

According to Romain Guy, setShadowLayer is only supported when hardware acceleration is on.

so make sure to turn on the acceleration from the application tag in the mainfest

<application android:hardwareAccelerated="true" ...>

You may check his answer here: Romain Guy's Answer

Community
  • 1
  • 1
MBH
  • 16,271
  • 19
  • 99
  • 149
  • Thanks :) I have just one short question. How is `setShadowLayer()` only supported when hardware acceleration is on and by setting `myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null)` we disable hardware acceleration? – user4386126 Apr 22 '15 at 03:23