xml - Changing the ActionBar title color of an Android app -
i have been reading asked questions still can't make color of text in actionbar change. code pretty copy/pasted instructions on following link: https://developer.android.com/training/basics/actionbar/styling.html#customtext
<!--theme applied application or activity--> <style name="myactionbartheme" parent="android:theme.holo"> <item name="android:actionbarstyle">@style/myactionbar</item> <item name="android:actionbartabtextstyle">@style/myactionbartabtext</item> <item name="android:actionmenutextcolor">@color/lightblue</item> </style> <!-- actionbar styles --> <style name="myactionbar" parent="android:widget.holo.actionbar"> <item name="android:titletextstyle">@style/myactionbartitletext</item> </style> <!-- actionbar title text --> <style name="myactionbartitletext" parent="android:textappearance.holo.widget.actionbar.title"> <item name="android:textcolor">@color/lightblue</item> <item name="android:textsize">16sp</item> </style> <!-- actionbar tabs text styles --> <style name="myactionbartabtext" parent="android:widget.holo.actionbar.tabtext"> <item name="android:textcolor">@color/lightblue</item> </style> <!-- base application theme, dependent on api level. theme replaced appbasetheme res/values-vxx/styles.xml on newer devices. --> <style name="appbasetheme" parent="android:theme.light"> <!-- theme customizations available in newer api levels can go in res/values-vxx/styles.xml, while customizations related backward-compatibility can go here. --> </style> <!-- application theme. --> <style name="apptheme" parent="appbasetheme"> <!-- customizations not specific particular api-level can go here. --> </style>
the last 2 styles not used might create conflict i'm not aware of. have in styles.xml, while androidmanifest code is:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.flexenergy.swapp" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="11" android:targetsdkversion="22" /> <uses-permission android:name="android.permission.internet"/> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@android:style/theme.holo.light" > <activity android:name="com.flexenergy.swapp.mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> <application android:allowbackup="true" android:theme="@style/myactionbartheme"> </application>
and last code of color.xml:
<item name="lightblue" type="color">#00ff00</item> <integer-array name="androidcolors"> <item>@color/lightblue</item> </integer-array>
i quite newbie in don't make assumption of should correct...
thanks in advance.
change android:theme="@android:style/theme.holo.light"
in manifest android:theme="@style/myactionbartheme"
, , rid of pointless second <application>
element. there 1 <application>
element per android manifest @ time.
Comments
Post a Comment