Steph8
Steph8

Reputation: 1583

Add a view shadow on android with appcelerator

i tried to put a shadow to my view on android, but i failed. I need to have a simply shadow like image of the desired result (and like iOS viewShadow property):

Upvotes: 0

Views: 2061

Answers (1)

Rene Pot
Rene Pot

Reputation: 24815

For Android you can use the Material Design cardviews, you can read about it here: http://www.appcelerator.com/blog/2015/11/titanium-5-1-0-sample-app/ which includes a sample app.

Documentation here: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Android.CardView

var card = Ti.UI.Android.createCardView({
    contentPadding: 20,
    cardCornerRadius: 10,
    cardUseCompatPadding: true
});

Most importantly, use the elevation property: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Android.CardView-property-elevation

This requires TiSDK 5.1.2 or higher, which was released yesterday

Upvotes: 3

Related Questions