Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7438883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:37:19+00:00 2026-05-29T10:37:19+00:00

I’m currently having an issue with using custom ListView adapters with the Holo.Light theme.

  • 0

I’m currently having an issue with using custom ListView adapters with the Holo.Light theme. Within the activities and fragments, any TextViews are displayed in the theme’s normal colours (textColorPrimary). However, any text within the custom ListAdapter uses textColorPrimary from the default Holo theme, effectively making the text unreadable.

Here is an example from my app’s main menu:


list_main_menu.xml – The row layout for the 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’m currently having to use android:textColor="?android:attr/textColorPrimaryInverse" to make the text readable.


fragment_main_menu.xml – The Main Menu fragment.

<?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’m not currently using any custom styles. Thanks for reading, and any useful comments will be greatly appreciated.

EDIT 1:
Here’s the requested screenshots.
asdf
This is how it looks if I don’t specify the text colour, it seems to be using the default text colour for Holo Dark

asdf
Manually specifying android:textColor="?android:attr/textColorPrimaryInverse" gives this result, but I’m uneasy at using a workaround like this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:37:20+00:00Added an answer on May 29, 2026 at 10:37 am

    You haven’t posted any actual code, but since I’ve had exactly the same problem, I would guess that you are passing the wrong Context to your custom adapter constructor.

    I’ve been doing something like this (within my Fragment):

    dataSource = new MyCursorAdapter(getActivity().getApplicationContext(), R.layout.myrow, data,
                fields, new int[] { R.id.field1, R.id.field2 });
    

    All I had to do to fix the problem, was to replace getActivity().getApplicationContext() by getActivity():

    dataSource = new MyCursorAdapter(getActivity(), R.layout.myrow, data,
                fields, new int[] { R.id.field1, R.id.field2 });
    

    And it started to work as expected.

    MyCursorAdapter (extending SimpleCursorAdapter) constructor:

    public MyCursorAdapter(Context context, int layout, Cursor c,
            String[] from, int[] to) { //... }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I'm having trouble keeping the paragraph square between the quote marks. In firefox the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.