2013-04-29 59 views
1

我想为我的记分牌设置我的黄金文本的颜色。我尝试了以下,但它不工作。我没有得到任何错误,但颜色并没有改变。任何想法为什么?不要想得到xml的颜色android

这是我color.xml这就是设置颜色为金记分牌我

<?xml version="1.0" encoding="utf-8"?> 
    <resources> 
     <style name="gold"> 
      <item name="android:textColor">#e6b121</item> 
     </style> 
    </resources> 

我用它在我的scoreboard.xml这样

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:background="@drawable/backgroundsb" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

    <ListView 
     android:id="@+id/listViewscores" 
     style="@style/gold" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" > 
    </ListView> 

    <Button 
     android:id="@+id/opnieuw" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     android:text="Opnieuw spelen" /> 

    </RelativeLayout> 
+0

这不会改变listitem的颜色,你需要改变列表行的颜色。发布你的活动代码,我将展示如何做到这一点 – Pragnani 2013-04-29 15:33:24

+0

settextcolor是不可能的我想? – 2013-04-29 16:03:30

+0

填充列表视图时,您将使用其行资源进行适配,您需要提供自定义布局 – Pragnani 2013-04-29 16:05:01

回答

0
<?xml version="1.0" encoding="utf-8"?><resources><color name="white">#FFFFFF</color><color name="black">#000000</color><color name="green">#008000</color><color name="blue">#0000FF</color>  <color name="red">#FF0000</color> <color name="gray">#858585</color></resources 

保存XML在值文件夹 中使用color.xml文件,并将其用于“android:textColor =”@ color/blue“文本视图