安卓:Holo Light 文字颜色

5
我有一个愚蠢的问题... 我在我的应用程序中使用(或更好地说,我应该使用)holo light主题:我已经在清单文件中设置了它。 看一下下面的截图:文本太浅了,是吗?好的,我知道我可以设置它,但我的问题是:这是holo主题中真正的文本颜色还是我的应用程序中存在错误?我认为是因为选择像这样难以辨认的颜色在谷歌中很奇怪。
编辑:
我使用属性设置了主题
android:theme="@android:style/Theme.Holo.Light"

关于应用元素的内容。

这里是我用ListFragment填充的ListView代码:

<?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>

希望你能帮助我:)。

你在ListView适配器中填充哪个布局? - Cheesebaron
你在上面找到的布局...不是吗?抱歉,我想我不明白你的意思 :D - user1315621
2个回答

17

当您创建适配器时,是使用应用程序上下文还是活动(Activity)?我遇到了完全相同的问题,但是注意到如果我像这样生成我的数组适配器:

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

那段文字一开始是白色的。但如果我使用了活动上下文(例如,在onCreate方法中,我可以直接使用"this"),那么文字就会变成黑色。我认为我的应用程序可能覆盖了主题。也许这也是你的问题所在?


0

看起来你正在使用默认主题,其默认文本颜色为#bfbfbf。我猜测你正在运行Android 2.x版本的应用程序,该版本未安装Holo light主题。


好的..现在我正在安卓4.1版本的Jelly Bean上运行这个应用程序。 - user1315621

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接