I am currently having a problem using custom ListView adapters with the Holo.Light theme. Within actions and fragments, any text objects are displayed in normal theme colors ( textColorPrimary ). However, any text in the custom ListAdapter uses textColorPrimary from the default Holo theme, which makes the text unreadable.
Here is an example from the main menu of my application:
list_main_menu.xml . Row Layout for ListAdapter
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/imgIcon" android:layout_height="48dip" android:layout_width="48dip" android:src="@drawable/ic_launcher" /> <TextView android:id="@+id/txtFirstLine" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/imgIcon" android:text="Line 1" android:textSize="12pt" /> <TextView android:id="@+id/txtSecondLine" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/imgIcon" android:layout_below="@id/txtFirstLine" android:text="Line 2" /> </RelativeLayout>
Note. I need to use android:textColor="?android:attr/textColorPrimaryInverse" to read text.
fragment_main_menu.xml - fragment of the main menu.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/txtWelcome" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Username" android:textSize="18sp" /> <ListView android:id="@id/android:list" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout>
AndroidManifext.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.michaeldodd.treasurehunter" android:versionCode="1" android:versionName="0.0.1" > <uses-sdk android:minSdkVersion="11" /> <uses-permission android:name="android.permission.INTERNET"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:label="@string/app_name" android:name=".gui.Login" android:theme="@android:style/Theme.Holo.Light"> <intent-filter > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".gui.Home" android:theme="@android:style/Theme.Holo.Light" /> <activity android:name=".gui.UserProfile" android:theme="@android:style/Theme.Holo.Light" /> <activity android:name=".gui.MapList" android:theme="@android:style/Theme.Holo.Light" /> </application> </manifest>
I am not currently using any custom styles. Thanks for reading, and any helpful comments would be greatly appreciated.
EDIT 1: Here are the requested screenshots.
This is how it looks, if I donβt specify the text color, it seems to use the default text color for Holo Dark
Manually specifying android:textColor="?android:attr/textColorPrimaryInverse" gives this result, but I'm embarrassed to use a workaround like this.
android android-listview android-theme
Michael Dodd Jan 24 2018-12-12T00: 00Z
source share