Why my custom theme doesn't affect my custom list item layout's textviews?

I'm trying to manage my application style using a custom theme:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
        <item name="actionBarTabStyle">@style/Widget.Sherlock.Light.ActionBar.TabView</item>
        <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
        <item name="android:textViewStyle">@style/MyTextViewStyle</item>
    </style>

    <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
        <item name="background">@drawable/background</item>
        <item name="android:background">@drawable/background</item>
    </style>

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

</resources>

As you can see, I set the TextView default color to @color/text (#ff000000). This works OK in all the TextViews of my application except the ones in my custom list item layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/mov_concept"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="2dp"
        android:textSize="16dp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/mov_category"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/mov_concept"
        android:layout_marginLeft="5dp"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/mov_amount"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/mov_category"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="6dp"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/mov_period"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/mov_amount"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="5dp"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/mov_until"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/mov_period"
        android:layout_alignBottom="@+id/mov_period"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="2dp"
        android:layout_marginRight="5dp"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/mov_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/mov_concept"
        android:layout_alignBottom="@+id/mov_category"
        android:layout_alignParentRight="true"
        android:layout_marginRight="5dp"
        android:layout_marginTop="2dp" />

</RelativeLayout>

I don't know why this happens, thank you in advance.

Answers


I had the same problem because of using Application Context instead of Activity Context for ListAdapter. To fix the issue I changed my code from

MyAdapter adapter = new MyAdapter(getApplicationContext(), ...) 

to

MyAdapter adapter = new MyAdapter(MyActivity.this, ...)

Need Your Help

tfs build definition with no drop folder

tfs tfs2010 build-automation

I've recently changed a number of my builds to not have a drop folder but now I'm getting the following error when I do this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.