I am attempting to override TextAppearance.Medium in a custom theme that is applied to my entire application with the appropriate entry in my application manifest. For some reason, the style I have specified is not applied to views nested within a ListView that I am populating using a custom layout and a SimpleAdapter. The style is applied to TextView views that are not items bound to a ListView.
Samples of the theme definition and custom layout are below.
To elucidate, I am not having problems populating the list with items utilizing the custom layout, my theme is definitely being applied throughout my application, and I am also aware that my list item layout could be optimized by using a RelativeLayout. I am simply looking for an answer as to why my list items are not being styled correctly.
Am I misunderstanding the capabilities of theme inheritance, or are there additional list-specific styles that I need to inherit/override?
API Level 7 (Android 2.1)
Testing using HTC Evo 4G, and generic AVD device
Theme Definition
<style name="Theme" parent="android:Theme.Light.NoTitleBar">
<item name="android:textAppearanceMedium">@style/TextAppearance.Medium</item>
</style>
<style name="TextAppearance.Medium" parent="android:style/TextAppearance.Medium">
<item name="android:textColor">@android:color/black</item>
</style>
List Item Layout Definition
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="horizontal" android:padding="10dp">
<TextView android:layout_width="wrap_content" android:text="TextView" android:id="@+id/jobItemDateDueTextView" android:layout_height="fill_parent" android:gravity="center" android:textStyle="bold" android:layout_marginRight="15dp"></TextView>
<LinearLayout android:layout_width="wrap_content" android:layout_height="fill_parent" android:orientation="vertical">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:id="@+id/jobItemHeaderTextView" android:maxLines="1" android:textAppearance="?android:attr/textAppearanceMedium"></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:id="@+id/jobItemContentTextView"></TextView>
</LinearLayout>
</LinearLayout>
Continuing the discussion from the comment thread above, the application
Contextwill not carry the same theming information along with it that yourActivitydoes. Use yourActivityinstance when you need aContextfor generating UI elements.