New in 3.2.0: Android text shadows

Another new feature in Titanium 3.2.0 is support for text shadows in Labels and Buttons on Android. I can finally stop using my nl.fokkezb.label widget now :)

ShadowRadius

However, there is a small catch in the implementation. For some reason you are required to set the shadowRadius to a minimal number as well before the shadow appears on Android. Leaving it unset or setting it to 0 does not result in a hard (not-blurred) shadow like you would expect.

Workaround

I created a ticket for this to be addressed, but until it is you can just set it to a very small number if you require a hard shadow:

var label = Ti.UI.createLabel({
  text: 'Hello world',
  color: '#000',
  shadowColor: '#F00',
  shadowOffset: {
    x: 1,
    y: 1
  },
  shadowRadius: 0.00001
});

App imagineer: Imagining, Engineering & Speaking about Native mobile Apps with Appcelerator Titanium & Alloy • Meetup organizer • Certified Expert • Titan


Comments