Set Text Color for textView Android

后端 未结 8 1847
梦谈多话
梦谈多话 2021-02-06 03:41

In the string.xml file i use the following tag

 \"#0000ff\"

If I use

 textview         


        
相关标签:
8条回答
  • 2021-02-06 03:58

    You need to create a set of styles in your xml (regularly in res/values/styles.xml)

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="gray">#eaeaea</color>
        <color name="titlebackgroundcolor">#00abd7</color>
        <color name="titlecolor">#666666</color>
    <resources>
    

    In the layout files you can call to the colors or styles:

    android:textColor="@color/titlecolor"
    

    Checkout some examples:

    http://developer.android.com/guide/topics/ui/themes.html

    0 讨论(0)
  • 2021-02-06 04:05

    This may be easier:

    TextView textresult = (TextView)findViewById(R.id.textView1);
    textresult.setTextColor(Color.RED);
    
    0 讨论(0)
提交回复
热议问题