Monday 14 July 2014


Styling Action bar in Titanium Android

Titanium SDK 3.0 Appcelerator includes support for Android action bar element, including support for action bar tabs, action items, access to actionbar title, background and home icon. To enable the action bar features, application must be build with target SDK version of 11 (Android 3.0) or above. Now we can customize action bar and can apply custom holo theme in our Android app.

Default Action bar



Styled Action bar including tabgroup












Follow below steps to create the Styling actionbar in Titanium Android.

1. Generate Action Bar style

Create action bar using Action Bar Generator. Style name should be one word without any punctuation. Set Style compatibility to Holo. Apply on for the settings, which you want to apply in your application theme and download zip file. Remember your style name, it will be used in app.xml to apply this theme in your app.

2. Add the zip files in the Project

Extract .zip file of your custom theme. After extracting, it will create res folder. You have to add this res folder in your projects in below hierarchy

$project_root$/platform/android/res

Note: If there is no platform and android folders already built in your application, then you have to manually create these folders and add res folder. Your resulting hierarchy will be

Titanium Classical Version
Titanium Alloy Version




3. Modify tiapp.xml to use custom style

Replace Android tag in your tiapp.xml

With this one

 

Clean your project and run. Custom themes will be available in your app

Now o/p is like :


1 comment:

  1. do you have a download for this?, I followed steaps and can't see changes.
    Thanks.

    ReplyDelete