Last Updated: February 25, 2016
·
6.483K
· denver

Transparency in background of views in Appcelerator Titanium

Titanium supports the RGBA color space which means you can use transparent colors!

Eg. You want a black background with 50% transparency in your view, do this:

var viewWithTransparentBackground = Titanium.UI.createView({ backgroundColor: 'rgba(0,0,0,0.5)' });

A in RGBA stands for Alpha transparency and is a float from 0 - 1.0. More about RBGA at: http://en.wikipedia.org/wiki/RGBA_color_space

3 Responses
Add your response

Another way to do this when using color hex values is to set the alpha channel's value immediately after the hash bang i.e. #50ff0000 will render a red background at 0.5 alpha.

over 1 year ago ·

Does either of these methods work on android?

over 1 year ago ·

thenewkid, yup, at least on ti-sdk 3.1.3 and android 4.2.2 x86!

over 1 year ago ·