Adding an Alloy widget to your application
So far, we've looked at some great features of Alloy—XML-based views, styles, and writing less JavaScript code. Another great feature of Alloy is the ability to use Widgets—these are small, packaged components that can be added to any Alloy application, allowing you to reuse them across applications. They have a simple view, controller, and styling structure, just like an Alloy project, and can easily be customized to fit your needs.
You've already seen how to perform navigation-based on TabGroup with Appcelerator, but one of the limitations of a TabGroup
on iOS is that you can't change the font used for the tabs. So let's change this using a widget that allows us to specify a font face and size to use.
How to do it…
Create a new Alloy project (or use your existing project from the previous recipe), and go to the terminal within the Project
folder. We're going to use gitt.io
to install the widget, as we...