I'm trying to style the Android tabs. I have it working on a native android application (so an app that isn't made with Appcelerator). But when i copy all the needed files over, then nothing happends. The only thing that changed is the color of the text on the tabs.
This is basically what i have done.
In tiapp.xml i have this for the AndroidManifest.
<android xmlns:android="http://schemas.android.com/apk/res/android"> <tool-api-level>15</tool-api-level> <manifest> <application android:debuggable="false" android:icon="@drawable/appicon" android:label="My Tabs" android:name="MyTabsApplication" android:theme="@style/Theme.mytheme"> </application> <supports-screens android:anyDensity="true"/> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14"/> </manifest> </android>Then i created a `platform/res' folder and pasted in all the needed files/folders that i have in my native android app.
One of them is in res/values called styles_mytheme.xml. In there i specified the following.
<resources> <style name="Theme.mytheme" parent="@android:style/Theme.Holo.Light"> <item name="android:actionBarItemBackground">@drawable/selectable_background_mytheme</item> <item name="android:popupMenuStyle">@style/mytheme_PopupMenu</item> <item name="android:dropDownListViewStyle">@style/mytheme_DropDownListView</item> <item name="android:actionBarTabStyle">@style/mytheme_ActionBarTabStyle</item> <item name="android:actionDropDownStyle">@style/mytheme_DropDownNav</item> <item name="android:actionBarStyle">@style/mytheme_solid_ActionBar</item> <item name="android:panelBackground">@drawable/menu_hardkey_panel_mytheme</item> </style> <style name="mytheme_solid_ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid"> <item name="android:background">@drawable/ab_solid_mytheme</item> <item name="android:backgroundStacked">@drawable/ab_stacked_solid_mytheme</item> <item name="android:backgroundSplit">@drawable/ab_bottom_solid_mytheme</item> <item name="android:progressBarStyle">@style/mytheme_ProgressBar</item> </style> <style name="mytheme_transparent_ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar"> <item name="android:background">@drawable/ab_transparent_mytheme</item> <item name="android:progressBarStyle">@style/mytheme_ProgressBar</item> </style> <style name="mytheme_PopupMenu" parent="@android:style/Widget.Holo.Light.ListPopupWindow"> <item name="android:popupBackground">@drawable/menu_dropdown_panel_mytheme</item> </style> <style name="mytheme_DropDownListView" parent="@android:style/Widget.Holo.Light.ListView.DropDown"> <item name="android:listSelector">@drawable/selectable_background_mytheme</item> </style> <style name="mytheme_ActionBarTabStyle" parent="@android:style/Widget.Holo.Light.ActionBar.TabView"> <item name="android:background">@drawable/tab_indicator_ab_mytheme</item> </style> <style name="mytheme_DropDownNav" parent="@android:style/Widget.Holo.Light.Spinner"> <item name="android:background">@drawable/spinner_background_ab_mytheme</item> <item name="android:popupBackground">@drawable/menu_dropdown_panel_mytheme</item> <item name="android:dropDownSelector">@drawable/selectable_background_mytheme</item> </style> <style name="mytheme_ProgressBar" parent="@android:style/Widget.Holo.Light.ProgressBar.Horizontal"> <item name="android:progressDrawable">@drawable/progress_horizontal_mytheme</item> </style> </resources>I also have all the other needed files that are referenced by the
styles_mytheme.xml file. My Titanium app also just builds fine. I basically have all the nine patch assets/xml files.
But when i launch my app i still get to see the original Holo theme on me tabs.
Anyone any idea how i can make my theme work in Appcelerator??
2 Answers
I can't imagine noone ever had the desire to add a custom style/theme to an Appcelerator app. Noone that has any idea?
I think by default the SDK is going to insert an <activity> element into the generated AndroidManifest.xml for the main activity. This <activity> element uses the Titanium theme (mainly to set the splash screen, I think). You can override this by inserting the <activity> element explicitly. For example:
<activity android:name=".MyappnameActivity" android:theme="@style/Theme.mytheme"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity>Of course the activity name will vary. I usually copy the activity element from the generated AndroidManifest.xml, paste it into tiapp.xml, and modify it.
Hope this helps.
Your Answer
Think you can help? Login to answer this question!