Android:textColor =“@ android:color / holo_blue_bright”无效

时间:2012-09-27 06:22:14

标签: android actionbarsherlock textcolor

我正在使用ActionBarSherlock Library。

在一个简单的布局中我有这个代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/shareWhat"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:textSize="15dp"
        android:text="@string/what_is_the_picture_about_" />

    <TextView
        android:id="@+id/shareProduct"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:text="@string/product_underlined"
        android:textColor="@android:color/holo_blue_dark"
        android:textSize="25dp" />

    <TextView
        android:id="@+id/sharePrice"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:text="@string/price_underlined"
        android:textColor="@android:color/holo_blue_light"
        android:textSize="25dp" />

    <TextView
        android:id="@+id/shareStore"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:text="@string/store_underlined"
        android:textColor="@android:color/holo_blue_bright"
        android:textSize="25dp" />

    <TextView
        android:id="@+id/shareMarket"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:text="@string/market_underlined"
        android:textColor="@android:color/holo_blue_bright"
        android:textSize="25dp" />

</LinearLayout>

我希望textColor为蓝色, @android:color 为蓝色有3个不同的值。我用了所有的3来检查哪一个看起来不错。

1. android:textColor="@android:color/holo_blue_dark"
2. android:textColor="@android:color/holo_blue_light"
3. android:textColor="@android:color/holo_blue_bright"

但是当我使用前两种颜色时,我得到white colored text。如果我使用的是第3种颜色,则textView本身不可见。

甚至没有出现。

为什么会这样?

我正在使用应用程序主题

android:theme="@style/Theme.Sherlock"

在我的清单中。

2 个答案:

答案 0 :(得分:2)

这些颜色是平台的一部分,而不是ActionBarSherlock。它们也是API 14+ only

答案 1 :(得分:1)

android:textColor属性正在寻找颜色十六进制字符串,即:

android:textColor="#0f0" 

这将使它变绿。找到您想要的颜色的十六进制值,并将其设置为