Android theme doesn't affect anything - android

I want every text in my app to be white.
This is what I did:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from 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 to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:textAppearance">#style/MyTextViewStyle</item>
</style>
<style name="MyTextViewStyle" parent="#android:style/TextAppearance">
<item name="android:textColor">#FFFFFFFF</item>
</style>
And in the manifest I set this attribute of the application tag: android:theme="#style/AppTheme"
Why won't the text color change?

You can try in this way:
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:textViewStyle">#style/MyTextViewStyle</item>
</style>

I think this might help. Use this for your textView style
<style name="MyTextViewStyle" parent="android:Widget.TextView">
<item name="android:textColor">#FFFFFFFF</item>
</style>
This should work.

Related

how can we change the title text color of customactionbar in android?

here is my styles.xml file. Can you please tell me how can i change the title text color of the actionbar. By default text is been show as Black color.
styles.xml
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from 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 to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background" >#color/MyColor</item>
<item name="background">#color/MyColor</item>
</style>
<style name="CustomActionBarTheme" parent="#style/Theme.AppCompat.Light">
<item name="android:actionBarStyle" >#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
Ok I've found a better way. I'm now able to only change the color of the title, you can also tweak the subtitle.
Here is my styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyTheme.ActionBarStyle</item>
</style>
<style name="MyTheme.ActionBarStyle"parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/red</item>
</resources>

How to change Action Bar title color in fragment

Am Having a Navigation Drawer in Fragment.And i want to change the action bar title color in this Fragment. For all other screens i used custom Action bar and its work fine over there. I also specified the style for Action bar title.
Here is my style.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from 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 to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="CustomActionBarTheme" parent="#android:style/Theme.Holo">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="#android:style/Widget.Holo.ActionBar">
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColorPrimary">#color/ActionBar_text</item>
</style>
<style name="PoppupMenu" parent="android:Widget.PopupMenu">
<item name="android:popupBackground">#android:color/white</item>
</style>
You want to change the parent of CustomActionBarTheme to #style/AppTheme
<style name="CustomActionBarTheme" parent="#stye/AppTheme">
Then change android:textColorPrimary to android:textColor
<item name="android:textColor">#color/ActionBar_text</item>

Don't change the text color of action bar in my android app

i want to do an orange action bar with text withe. I've done the following theme
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from 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 to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#FF6600</item>
<item name="android:titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
</resources>
In the end i've setted the theme in the manifest; but when i run the app the text color of title of the action bar is black ( instead white). What i have to do ?

Remove icon space from TabHost

I need to remove the space between text and top border. I want it to be aligned to center.
Now my TabHost looks like this
I need to convert into something like this
My styles.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from 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 to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:tabWidgetStyle">#style/LightTabWidget</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#0767de</item>
</style>
<style name="MyActionBar1" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:textColor">#ffffff</item>
</style>
<style name="LightTabWidget" parent="#android:style/Widget.TabWidget">
<!-- set textColor to red, so you can verify that it applied. -->
<item name="android:textColor">#0767de</item>w
<item name="android:textSize">14sp</item>
<item name="android:tabStripEnabled">false</item>
</style>
Thanks in advance

I can't change the colour of subtitle in actionbar

I am trying to change the color of subtitle in actionbar but it doesn't change.
Here is the screenshot.
Here is styles.xml
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:subtitleTextStyle">#style/MyActionBar.TitleTextStyle</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/actionbarBackground</item>
<item name="android:tabStripEnabled">true</item>
<item name="backgroundSplit">#color/white</item>
</style>
<style name="MyActionBar.TitleTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
<item name="android:textColor">#color/white</item>
</style>
The android:subtitleTextStyle attribute is inherit of Widget.ActionBar. You need to move it into your MyActionBar style, not your root theme.
Also, don't forget to add support library compatibility since you're using AppCompat:
<style name="MyActionBar" parent="android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
...
<item name="android:subtitleTextStyle">#style/MyActionBar.TitleTextStyle</item>
<!-- Support library compatibility -->
<item name="subtitleTextStyle">#style/MyActionBar.TitleTextStyle</item>
</style>
Add below code in your activity file
actionBar.setSubtitle(Html.fromHtml("<font color='subtitleColor'>Here ActionBar Subtitle</font>"));

Categories

Resources