hugocarlmartin
hugocarlmartin

Reputation: 719

Titanium Android Action Bar theme

Im using SDK 3.0 and with the xml down here I can change the tabs into Holo Dark theme. Is it possible to change fontsize, because the one I get gives me a swipeable tabBar? And can I get the color pink instead of the blue one?

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <tool-api-level>14</tool-api-level>
    <manifest>
    <application android:theme="@android:style/Theme.Holo"></application>
    </manifest>
</android>

Edit: I tried to follow this exampel: Android Action Bar theme But i can't get it to work. Otherwise this is exectly what I want.

Upvotes: 0

Views: 4116

Answers (3)

I wrote a blog post about how to use a custom Holo Theme in Titanium Mobile: http://blog.rafaelks.com/post/47898772164/how-to-use-custom-holo-theme-in-android-with-titanium.

It's similar to manumaticx answer.

Upvotes: 0

manumaticx
manumaticx

Reputation: 111

You can use the ActionBar Style Generator to customize your ActionBar Theme. The tool gives you all resources you need within a "res"-folder. Just copy that folder to platform/android beneath your application's root project directory.

In your custom Manifest or directly in the tiapp.xml you refer to that theme by its name:

<android xmlns:android="http://schemas.android.com/apk/res/android">
   <manifest>
       <application android:theme="@style/Theme.myCustomActionBarTheme" />
   </manifest>
</android>

This solution works very fine for me - and I hope it helps!

Upvotes: 1

ottel142
ottel142

Reputation: 2016

I'm using the ActionBarSherlock to support an Action Bar on all platforms. It provides huge custom styling opportunities. I changed the blue separator to a green one. Here's my xml:

AndroidManifest.xml

<application android:theme="@style/Theme.GreenAB"></application>

/res/values/abs_green_style.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.GreenAB" parent="Theme.Sherlock.ForceOverflow">
    <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>

<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="android:background">@drawable/green_style</item>
    <item name="background">@drawable/green_style</item>
</style>
</resources>

/res/drawable/green_style.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Green Bottom Line -->
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#FF177506" />
        </shape>
    </item>

    <!-- Color of the action bar -->
    <item android:bottom="2dip">
        <shape android:shape="rectangle">
            <solid android:color="#000000" />
        </shape>
    </item>
</layer-list>

If you don't need support on all platforms you might even use this without third-party libraries. Replace the parent theme (Theme.Sherlock.ForceOverflow) with an Android resource and remove the duplicate item entries in the style sections.

Upvotes: 1

Related Questions