Alloy ListView & Facebook Friends – Part Two
See Part One where we create the ListView content in the controller Alloy ListView & Facebook Friends – Part One
Using ListViews in your application will provide you with a tremendous performance improvement in your applications. You will undoubtedly see the biggest gains in your Android applications.
This post is an update on the previous post I wrote in that here we will be using the new Alloy 1.2 support for templates in the actual view.xml file. This means less UI code in the controller and more in the view where it belongs.
See the code below and if there are question, post them to the comment section below
Notice the creation of the templates and the sections in the xml file. This will help to keep the controller nice and clean.
Here I have added all of the styling to the .tss file, once again cleaning up the controller. Notice the use of the platform option one the template1 style; I have done this because on Android the ListView and autosize the row, but that is not functional in IOS.
In the code, specifically the function createListView, notice how much different this looks from the index.js in part one. We have removed all of the template and section code and now Alloy sets it all up for us.
Be sure to come back for more information on using Titanium Alloy. Also look out for my book on Appcelerator Titanium Alloy and Appcelerator Cloud Service which is coming out this fall from Wiley.