0

I have defined a global TextView style which extends from TextView and overrides all TextView colors white:

<style name="TextViewTM_63" parent="android:Widget.TextView">
    <item name="android:textColor">@android:color/white</item>
</style>

It's also correctly configured in my manifest - all TextViews that are NOT elements in a ListView are styled correctly. So this is the problem: this global style is NOT applied to elements that are inflated in the corresponding ListView Adapter. When I add the style tag manually to all TextView elements that appear in the ListView element all goes right - but shouldnt it be also without this? I tried to add a TextView style to the ListView style but nothing happend..

<style name="listView" parent="android:Widget.ListView">
    <item name="android:background">@null</item>
    <item name="android:divider">@null</item>
    <item name="android:dividerHeight">0dip</item>
    <item name="android:listSelector">@drawable/selector_lv</item>
    <item name="android:scrollbarAlwaysDrawVerticalTrack">true</item>
    <item name="android:scrollbarSize">1dp</item>
    <item name="android:scrollbars">vertical</item>
    <item name="android:textAppearance">@style/TextViewTM_63</item>
</style>

Is there any point I am missing?

KomalG
  • 808
  • 9
  • 18
and_dev
  • 3,723
  • 1
  • 20
  • 28
  • Post your code for inflating. Are you using the Activity Context or the application context? It needs to be the activity, see http://stackoverflow.com/questions/2118251/theme-style-is-not-applied-when-inflater-used-with-applicationcontext – Gabe Sechan Feb 17 '15 at 07:56

1 Answers1

1

Solved it - I was using getApplicationContext() when instantiating the ArrayAdapter instead of setting the Activity as context. Thank you!

and_dev
  • 3,723
  • 1
  • 20
  • 28