tags:

views:

247

answers:

2

I have a listview with two labels, title and subtitle. I want to have dark and light background as user options. Title has textAppearanceMedium and subtitle has textAppearanceSmall. I want the style, MyTheme.Dark to have white color text and MyTheme.Light to have black color text. Is there a way to define multiple textAppearance attribute for the same TextView widget?

<style name="MyTheme.Dark">
    <item name="android:windowBackground">@color/black</item>
    <item name="android:colorBackground">@color/black</item>
    <item name="android:background">@color/black</item>
    <item name="android:divider">@color/white</item>
        --cannot put textAppearance here since it is different for title and subtitle
    </style>
+1  A: 

I'm a beginner with Android myself and I'm not sure if I'm not making an ass of myself here, but why don't you use the android:textColor property?

<style name="MyTheme.Dark">
    <item name="android:windowBackground">@color/black</item>
    <item name="android:colorBackground">@color/black</item>
    <item name="android:background">@color/black</item>
    <item name="android:divider">@color/white</item>
    <item name="android:textColor">@color/white</item>
</style>
Shade
The theme will be applied to the Activity. I will have other text attributes that are different for title and subtitle. Looks like I need to rephrase my question.
dipu
the system defined textAppearance style has color,size specified. Hence the color set in theme does not apply to the TextView widgets. Tried defining my own textAppearance style still no luck. Looks like the ListView gets some listAppearance even if I do not specify it.
dipu
A: 

I think best way is to have different layout xml for different colors and themes. Load the layout xml based on user choice. I do not like this but I have not found any alternatives.

dipu