Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: text color holo light

I just have a stupid question... I am using (or better, I suppose to use) the theme holo light in my application: I have set it in the manifest file. Look at the screenshot below: the text is too light, isn't it? Ok, I know that I can set it but my question is: is it the real text color in holo theme or there is an error in my application? I suppose it because it's strange that in google an illegibile color like this was chosen.

enter image description here

EDIT:

I set the theme with the attribute

android:theme="@android:style/Theme.Holo.Light"

of the application element. Here is the listview code whick I populated with a listfragment:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/songsLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="left"
    android:orientation="vertical"
    android:padding="12dp" >

    <ListView
        android:id="@id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fastScrollEnabled="true"
        android:scrollbarStyle="insideInset"
        android:textFilterEnabled="false"/>

    <TextView
        android:id="@+id/songsFragment_titleTextView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingTop="7dp"
        android:paddingBottom="0dp"
        android:textSize="18sp"
        android:lines="1">
    </TextView>

    <TextView
        android:id="@+id/songsFragment_artistTextView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="7dp"
        android:paddingTop="0dp"
        android:lines="1" 
        android:textSize="14sp">

    </TextView>

</LinearLayout>

Hope you can help me :)

like image 728
user1315621 Avatar asked Dec 28 '12 19:12

user1315621


1 Answers

When you create your Adapter, are you using the application context or the activity? I just ran into the exact same problem but noticed if I generated my Array Adapter like this:

ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(getApplicationContext(),
                    android.R.layout.simple_list_item_1, tables);
            setListAdapter(listAdapter);

Then the text was appearing white. If, however, I used the activity context (so if I was doing the above in the onCreate method, I could just use "this") the text was black. I think somehow my app was overriding the theme. Perhaps that is / was your issue as well?

like image 72
Chris Avatar answered Nov 15 '22 00:11

Chris