Can't set TextView shadow programmatically

Viewed 12345

I'm creating a TextView dynamically and set shadow to it using the method posted here: Android - shadow on text?

But it doesn't work. The style is applied (put textSize item to test, and it works), but the shadow doesn't appear.

TextView:

TextView tv = new TextView(this);
RelativeLayout.LayoutParams layoutPars = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutPars.addRule(RelativeLayout.CENTER_VERTICAL); 
tv.setTextColor(0xffffffff);
tv.setText(label);
tv.setTextSize(11);
tv.setTextAppearance(getApplicationContext(), R.style.BlackShadow);

Style:

<style name="BlackShadow">  
    <item name="android:shadowColor">#ff000000</item>
    <item name="android:shadowRadius">1</item>
    <item name="android:shadowDx">-1</item>
    <item name="android:shadowDy">-1</item>
    <item name="android:textSize">26dip</item>
</style>

What am I doing wrong?

1 Answers
Related