O'Reilly logo

Appcelerator Titanium Smartphone App Development Cookbook - Second Edition by Jason Kneen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Changing the look of your app with styles

One of the cool features of Alloy is the ability to separate the visual elements of your app from your code. This can be done via XML files, as we've already done, or you can use Alloy TSS styles to apply properties to elements in a view. In this recipe, we'll be updating the code from the last recipe and moving our styling into a separate file.

Looking back at the previous recipe, we have a view containing the following XML:

<Alloy> <Window backgroundColor="white" layout="vertical"> <Label id="myLabel" borderRadius="2" top="40" borderColor="#CCC" height="35" width="200"/> <Button id="myButton" borderRadius="2" backgroundColor="#35e" color="#fff" top="10" height="35" width="100">Click me!</Button> </Window> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required