Android 的res/values/colors自定义颜色列表和注释表及布局文件常用颜色引用,颜色设置

Android中设置文本颜色的四种方法:

一、利用系统自带的颜色类

tx.setTextColor(android.graphics.Color.RED);

二、数字颜色表示

tx.setTextColor(0xffff00f);

三、自定义颜色

在工程目录values文件夹下的color.xml(没有自己新建)。

四、直接在xml的TextView中设置

android:textColor=”#F8F8FF00” 或

android:textColor=”#F8FF00”


这里主要是列出第三条:
在color.xml里面的配置是这样的:
Android 的res/values/colors自定义颜色列表和注释表及布局文件常用颜色引用,颜色设置_第1张图片

这样做的好处就是常用的颜色可以直接调用,既方便的开发,也方便做统一的修改和代码的维护。体现了复用性的价值。
Android 的res/values/colors自定义颜色列表和注释表及布局文件常用颜色引用,颜色设置_第2张图片

当然如果用的是AS(android studio)的话,在编辑页左边数列对于颜色是由提示显示的。系统也提供的可以自有修改和定义颜色的功能,直接用鼠标点击,就会弹出修改的颜色功能窗。
Android 的res/values/colors自定义颜色列表和注释表及布局文件常用颜色引用,颜色设置_第3张图片


附Android中146种颜色对应的xml色值及注释:
(找不到的可以Ctrl+F进行页面查找)




<resources>
    <color name="white">#FFFFFFcolor> 
    <color name="ivory">#FFFFF0color> 
    <color name="lightyellow">#FFFFE0color> 
    <color name="yellow">#FFFF00color> 
    <color name="snow">#FFFAFAcolor> 
    <color name="floralwhite">#FFFAF0color> 
    <color name="lemonchiffon">#FFFACDcolor> 
    <color name="cornsilk">#FFF8DCcolor> 
    <color name="seashell">#FFF5EEcolor> 
    <color name="lavenderblush">#FFF0F5color> 
    <color name="papayawhip">#FFEFD5color> 
    <color name="blanchedalmond">#FFEBCDcolor> 
    <color name="mistyrose">#FFE4E1color> 
    <color name="bisque">#FFE4C4color> 
    <color name="moccasin">#FFE4B5color> 
    <color name="navajowhite">#FFDEADcolor> 
    <color name="peachpuff">#FFDAB9color> 
    <color name="gold">#FFD700color> 
    <color name="pink">#FFC0CBcolor> 
    <color name="lightpink">#FFB6C1color> 
    <color name="orange">#FFA500color> 
    <color name="lightsalmon">#FFA07Acolor> 
    <color name="darkorange">#FF8C00color> 
    <color name="coral">#FF7F50color> 
    <color name="hotpink">#FF69B4color> 
    <color name="tomato">#FF6347color> 
    <color name="orangered">#FF4500color> 
    <color name="deeppink">#FF1493color> 
    <color name="fuchsia">#FF00FFcolor> 
    <color name="magenta">#FF00FFcolor> 
    <color name="red">#FF0000color> 
    <color name="oldlace">#FDF5E6color> 
    <color name="lightgoldenrodyellow">#FAFAD2color> 
    <color name="linen">#FAF0E6color> 
    <color name="antiquewhite">#FAEBD7color> 
    <color name="salmon">#FA8072color> 
    <color name="ghostwhite">#F8F8FFcolor> 
    <color name="mintcream">#F5FFFAcolor> 
    <color name="whitesmoke">#F5F5F5color> 
    <color name="beige">#F5F5DCcolor> 
    <color name="wheat">#F5DEB3color> 
    <color name="sandybrown">#F4A460color> 
    <color name="azure">#F0FFFFcolor> 
    <color name="honeydew">#F0FFF0color> 
    <color name="aliceblue">#F0F8FFcolor> 
    <color name="khaki">#F0E68Ccolor> 
    <color name="lightcoral">#F08080color> 
    <color name="palegoldenrod">#EEE8AAcolor> 
    <color name="violet">#EE82EEcolor> 
    <color name="darksalmon">#E9967Acolor> 
    <color name="lavender">#E6E6FAcolor> 
    <color name="lightcyan">#E0FFFFcolor> 
    <color name="burlywood">#DEB887color> 
    <color name="plum">#DDA0DDcolor> 
    <color name="gainsboro">#DCDCDCcolor> 
    <color name="crimson">#DC143Ccolor> 
    <color name="palevioletred">#DB7093color> 
    <color name="goldenrod">#DAA520color> 
    <color name="orchid">#DA70D6color> 
    <color name="thistle">#D8BFD8color> 
    <color name="lightgray">#D3D3D3color> 
    <color name="lightgrey">#D3D3D3color> 
    <color name="tan">#D2B48Ccolor> 
    <color name="chocolate">#D2691Ecolor> 
    <color name="peru">#CD853Fcolor> 
    <color name="indianred">#CD5C5Ccolor> 
    <color name="mediumvioletred">#C71585color> 
    <color name="silver">#C0C0C0color> 
    <color name="darkkhaki">#BDB76Bcolor> 
    <color name="rosybrown">#BC8F8Fcolor> 
    <color name="mediumorchid">#BA55D3color> 
    <color name="darkgoldenrod">#B8860Bcolor> 
    <color name="firebrick">#B22222color> 
    <color name="powderblue">#B0E0E6color> 
    <color name="lightsteelblue">#B0C4DEcolor> 
    <color name="paleturquoise">#AFEEEEcolor> 
    <color name="greenyellow">#ADFF2Fcolor> 
    <color name="lightblue">#ADD8E6color> 
    <color name="darkgray">#A9A9A9color> 
    <color name="darkgrey">#A9A9A9color> 
    <color name="brown">#A52A2Acolor> 
    <color name="sienna">#A0522Dcolor> 
    <color name="darkorchid">#9932CCcolor> 
    <color name="palegreen">#98FB98color> 
    <color name="darkviolet">#9400D3color> 
    <color name="mediumpurple">#9370DBcolor> 
    <color name="lightgreen">#90EE90color> 
    <color name="darkseagreen">#8FBC8Fcolor> 
    <color name="saddlebrown">#8B4513color> 
    <color name="darkmagenta">#8B008Bcolor> 
    <color name="darkred">#8B0000color> 
    <color name="blueviolet">#8A2BE2color> 
    <color name="lightskyblue">#87CEFAcolor> 
    <color name="skyblue">#87CEEBcolor> 
    <color name="gray">#808080color> 
    <color name="grey">#808080color> 
    <color name="olive">#808000color> 
    <color name="purple">#800080color> 
    <color name="maroon">#800000color> 
    <color name="aquamarine">#7FFFD4color> 
    <color name="chartreuse">#7FFF00color> 
    <color name="lawngreen">#7CFC00color> 
    <color name="mediumslateblue">#7B68EEcolor> 
    <color name="lightslategray">#778899color> 
    <color name="lightslategrey">#778899color> 
    <color name="slategray">#708090color> 
    <color name="slategrey">#708090color> 
    <color name="olivedrab">#6B8E23color> 
    <color name="slateblue">#6A5ACDcolor> 
    <color name="dimgray">#696969color> 
    <color name="dimgrey">#696969color> 
    <color name="mediumaquamarine">#66CDAAcolor> 
    <color name="cornflowerblue">#6495EDcolor> 
    <color name="cadetblue">#5F9EA0color> 
    <color name="darkolivegreen">#556B2Fcolor> 
    <color name="indigo">#4B0082color> 
    <color name="mediumturquoise">#48D1CCcolor> 
    <color name="darkslateblue">#483D8Bcolor> 
    <color name="steelblue">#4682B4color> 
    <color name="royalblue">#4169E1color> 
    <color name="turquoise">#40E0D0color> 
    <color name="mediumseagreen">#3CB371color> 
    <color name="limegreen">#32CD32color> 
    <color name="darkslategray">#2F4F4Fcolor> 
    <color name="darkslategrey">#2F4F4Fcolor> 
    <color name="seagreen">#2E8B57color> 
    <color name="forestgreen">#228B22color> 
    <color name="lightseagreen">#20B2AAcolor> 
    <color name="dodgerblue">#1E90FFcolor> 
    <color name="midnightblue">#191970color> 
    <color name="aqua">#00FFFFcolor> 
    <color name="cyan">#00FFFFcolor> 
    <color name="springgreen">#00FF7Fcolor> 
    <color name="lime">#00FF00color> 
    <color name="mediumspringgreen">#00FA9Acolor> 
    <color name="darkturquoise">#00CED1color> 
    <color name="deepskyblue">#00BFFFcolor> 
    <color name="darkcyan">#008B8Bcolor> 
    <color name="teal">#008080color> 
    <color name="green">#008000color> 
    <color name="darkgreen">#006400color> 
    <color name="blue">#0000FFcolor> 
    <color name="mediumblue">#0000CDcolor> 
    <color name="darkblue">#00008Bcolor> 
    <color name="navy">#000080color> 
    <color name="black">#000000color> 

resources>

在这里呢,也分享一个简单实用的屏幕取色器。可以直接对着自己想要的颜色进行取色。

屏幕取色器

http://download.csdn.net/detail/w630886916/9684068


附上:Color Hex Color Codes
地址1:https://www.colorcodehex.com/
地址2:http://www.color-hex.com/
可以查阅各个颜色的RGB的数值及其他详细数值。

你可能感兴趣的:(整理,布局,android,xml)