pu4isw
Last Updated: February 25, 2016
·
5.636K
· denver
92e51ec70e264ab14e7e4606f79464ef

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

Say Thanks
Respond

3 Responses
Add your response

3355

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 ·
9707

Does either of these methods work on android?

over 1 year ago ·
9782

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

over 1 year ago ·