68 Flares 68 Flares ×

Appcelerator’s Android support just got better with the AppCompat library. If you remember from this post and this other one, Android apps built with Titanium didn’t have the ActionBar activated by default, and your Windows looked something like this:


You then had to open up your tiapp.xml and add some lines of code to activate the proper theme that will give you the ActionBar and set it to use API Level 11 (Android 3.0), and since the ActionBar was not available to versions below 3.0, you had to rework your app’s UI to accommodate to those cases. This was not a Titanium problem though, but an Android one, which was fixed by the creation of the AppCompat Library, now supported by Titanium.

What does this mean for you? Well it means that your Android apps now support the ActionBar on devices running Android 2.1 (API Level 7) and up, and this without making any special changes to your code. For example, a simple window like this,

will give you this result.


Your Android apps will now follow the Android’s UX guidelines, as far as the ActionBar is concerned, even on devices running old versions of Android.

Customizing and branding your Android apps

You can customize the look your ActionBar to match your app’s branding by creating custom ActionBar themes. Themes now, however, need to inherit from AppCompat and not from Holo like before. If your app was using Holo, Holo Light or Holo Light DarkActionBar, this guide shows you how to create the AppCompat equivalents.

When creating custom themes using the Android Action Bar Style Generator you simply need to make sure that you specify AppCompat compatibility as shown below.


Then download the resources like before and save them to /platform/android/res and add it to your tiapp.xml, for example:

Based on this example, your app with a custom Green ActionBar Theme will look like this:


Feel free to download the examples from Github and test them out yourself.

68 Flares Twitter 28 Facebook 8 Google+ 13 LinkedIn 19 Email -- 68 Flares ×