1. 在代码中可以直接用系统自带的颜色。如,Color.BLACK来取得一个黑色;但是一般都是自己设定一个颜色的xml,比较方便。在代码中引用 Context.getResources().getColor(R.color.XXX),一般可以直接getColor(),在xml中用@color/XXX。
在res/values下,创建color.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="BLACK">#000000</color> //加入自己需要的颜色 </resources>
文中结尾附带常用颜色copy件。
2. 关于设置透明,一种是在代码中用drawable.setAlpha(int), 0到255,0为透明,255为不透明;如果是view.setAlpha(float),则是0到1,0为透明,1为不透明;或者在xml中,android:alpha="",0到1,不过在xml中设置需要API 11。还有一种是直接给颜色代码透明,例如半透明的黑色#55000000。开头两个是Alpha属性,FF就是不透明,00就是透明。
常用颜色:
<color name="White">#FFFFFF</color>
<color name="Ivory">#FFFFF0</color>
<color name="LightYellow">#FFFFE0</color>
<color name="Yellow">#FFFF00</color>
<color name="Snow">#FFFAFA</color>
<color name="FloralWhite">#FFFAF0</color>
<color name="LemonChiffon">#FFFACD</color>
<color name="Cornsilk">#FFF8DC</color>
<color name="Seashell">#FFF5EE</color>
<color name="LavenderBlush">#FFF0F5</color>
<color name="PapayaWhip">#FFEFD5</color>
<color name="BlanchedAlmond">#FFEBCD</color>
<color name="MistyRose">#FFE4E1</color>
<color name="Bisque">#FFE4C4</color>
<color name="Moccasin">#FFE4B5</color>
<color name="NavajoWhite">#FFDEAD</color>
<color name="PeachPuff">#FFDAB9</color>
<color name="Gold">#FFD700</color>
<color name="Pink">#FFC0CB</color>
<color name="LightPink">#FFB6C1</color>
<color name="Orange">#FFA500</color>
<color name="LightSalmon">#FFA07A</color>
<color name="DarkOrange">#FF8C00</color>
<color name="Coral">#FF7F50</color>
<color name="HotPink">#FF69B4</color>
<color name="Tomato">#FF6347</color>
<color name="OrangeRed">#FF4500</color>
<color name="DeepPink">#FF1493</color>
<color name="Fuchsia">#FF00FF</color>
<color name="Magenta">#FF00FF</color>
<color name="Red">#FF0000</color>
<color name="OldLace">#FDF5E6</color>
<color name="LightGoldenrodYellow">#FAFAD2</color>
<color name="Linen">#FAF0E6</color>
<color name="AntiqueWhite">#FAEBD7</color>
<color name="Salmon">#FA8072</color>
<color name="GhostWhite">#F8F8FF</color>
<color name="MintCream">#F5FFFA</color>
<color name="WhiteSmoke">#F5F5F5</color>
<color name="Beige">#F5F5DC</color>
<color name="Wheat">#F5DEB3</color>
<color name="SandyBrown">#F4A460</color>
<color name="Azure">#F0FFFF</color>
<color name="Honeydew">#F0FFF0</color>
<color name="AliceBlue">#F0F8FF</color>
<color name="Khaki">#F0E68C</color>
<color name="LightCoral">#F08080</color>
<color name="PaleGoldenrod">#EEE8AA</color>
<color name="Violet">#EE82EE</color>
<color name="DarkSalmon">#E9967A</color>
<color name="Lavender">#E6E6FA</color>
<color name="LightCyan">#E0FFFF</color>
<color name="BurlyWood">#DEB887</color>
<color name="Plum">#DDA0DD</color>
<color name="Gainsboro">#DCDCDC</color>
<color name="Crimson">#DC143C</color>
<color name="PaleVioletRed">#DB7093</color>
<color name="Goldenrod">#DAA520</color>
<color name="Orchid">#DA70D6</color>
<color name="Thistle">#D8BFD8</color>
<color name="LightGrey">#D3D3D3</color>
<color name="Tan">#D2B48C</color>
<color name="Chocolate">#D2691E</color>
<color name="Peru">#CD853F</color>
<color name="IndianRed">#CD5C5C</color>
<color name="MediumVioletRed">#C71585</color>
<color name="Silver">#C0C0C0</color>
<color name="DarkKhaki">#BDB76B</color>
<color name="RosyBrown">#BC8F8F</color>
<color name="MediumOrchid">#BA55D3</color>
<color name="DarkGoldenrod">#B8860B</color>
<color name="FireBrick">#B22222</color>
<color name="PowderBlue">#B0E0E6</color>
<color name="LightSteelBlue">#B0C4DE</color>
<color name="PaleTurquoise">#AFEEEE</color>
<color name="GreenYellow">#ADFF2F</color>
<color name="LightBlue">#ADD8E6</color>
<color name="DarkGray">#A9A9A9</color>
<color name="Brown">#A52A2A</color>
<color name="Sienna">#A0522D</color>
<color name="YellowGreen">#9ACD32</color>
<color name="DarkOrchid">#9932CC</color>
<color name="PaleGreen">#98FB98</color>
<color name="DarkViolet">#9400D3</color>
<color name="MediumPurple">#9370DB</color>
<color name="LightGreen">#90EE90</color>
<color name="DarkSeaGreen">#8FBC8F</color>
<color name="SaddleBrown">#8B4513</color>
<color name="DarkMagenta">#8B008B</color>
<color name="DarkRed">#8B0000</color>
<color name="BlueViolet">#8A2BE2</color>
<color name="LightSkyBlue">#87CEFA</color>
<color name="SkyBlue">#87CEEB</color>
<color name="Gray">#808080</color>
<color name="Olive">#808000</color>
<color name="Purple">#800080</color>
<color name="Maroon">#800000</color>
<color name="Aquamarine">#7FFFD4</color>
<color name="Chartreuse">#7FFF00</color>
<color name="LawnGreen">#7CFC00</color>
<color name="MediumSlateBlue">#7B68EE</color>
<color name="LightSlateGray">#778899</color>
<color name="SlateGray">#708090</color>
<color name="OliveDrab">#6B8E23</color>
<color name="SlateBlue">#6A5ACD</color>
<color name="DimGray">#696969</color>
<color name="MediumAquamarine">#66CDAA</color>
<color name="CornflowerBlue">#6495ED</color>
<color name="CadetBlue">#5F9EA0</color>
<color name="DarkOliveGreen">#556B2F</color>
<color name="Indigo">#4B0082</color>
<color name="MediumTurquoise">#48D1CC</color>
<color name="DarkSlateBlue">#483D8B</color>
<color name="SteelBlue">#4682B4</color>
<color name="RoyalBlue">#4169E1</color>
<color name="Turquoise">#40E0D0</color>
<color name="MediumSeaGreen">#3CB371</color>
<color name="LimeGreen">#32CD32</color>
<color name="DarkSlateGray">#2F4F4F</color>
<color name="SeaGreen">#2E8B57</color>
<color name="ForestGreen">#228B22</color>
<color name="LightSeaGreen">#20B2AA</color>
<color name="DodgerBlue">#1E90FF</color>
<color name="MidnightBlue">#191970</color>
<color name="Aqua">#00FFFF</color>
<color name="Cyan">#00FFFF</color>
<color name="SpringGreen">#00FF7F</color>
<color name="Lime">#00FF00</color>
<color name="MediumSpringGreen">#00FA9A</color>
<color name="DarkTurquoise">#00CED1</color>
<color name="DeepSkyBlue">#00BFFF</color>
<color name="DarkCyan">#008B8B</color>
<color name="Teal">#008080</color>
<color name="Green">#008000</color>
<color name="DarkGreen">#006400</color>
<color name="Blue">#0000FF</color>
<color name="MediumBlue">#0000CD</color>
<color name="DarkBlue">#00008B</color>
<color name="Navy">#000080</color>
<color name="Black">#000000</color>
"粉红","#FFB3A7"
"妃色","#ED5736"
"品红","#F00056"
"桃红","#F47983"
"海棠红","#DB5A6B"
"石榴红","#F20C00"
"樱桃红","#C93756"
"银红","#F05654"
"大红","#FF2121"
"绛紫","#8C4356"
"绯红","#C83C23"
"胭脂","#9D2933"
"朱红","#FF4C00"
"丹","#FF4E20"
"彤","#F35336"
"茜色","#CB3A56"
"火红","#FF2D51"
"赫赤","#C91F37"
"嫣红","#EF7A82"
"洋红","#FF0097"
"炎","#FF3300"
"绾","#A98175"
"枣红","#C32136"
"檀","#B36D61"
"殷红","#BE002F"
"酡红","#DC3023"
"酡颜","#F9906F"
"鹅黄","#FFF143"
"鸭黄","#FAFF72"
"樱草色","#EAFF56"
"杏黄","#FFA631"
"杏红","#FF8C31"
"橘黄","#FF8936"
"橙黄","#FFA400"
"橘红","#FF7500"
"姜黄","#FFC773"
"缃色","#F0C239"
"橙色","#FA8C35"
"茶色","#B35C44"
"驼色","#A88462"
"昏黄","#C89B40"
"栗色","#60281E"
"棕色","#B25D25"
"棕绿","#827100"
"棕黑","#7C4B00"
"棕红","#9B4400"
"棕黄","#AE7000"
"赭","#9C5333"
"赭色","#955539"
"琥珀","#CA6924"
"褐色","#6E511E"
"枯黄","#D3B17D"
"黄栌","#E29C45"
"秋色","#896C39"
"秋香色","#D9B611"
"嫩绿","#BDDD22"
"柳黄","#C9DD22"
"柳绿","#AFDD22"
"竹青","#789262"
"葱黄","#A3D900"
"葱绿","#9ED900"
"葱青","#0EB83A"
"青葱","#0AA344"
"油绿","#00BC12"
"绿沈","#0C8918"
"碧色","#1BD1A5"
"碧绿","#2ADD9C"
"青碧","#48C0A3"
"翡翠色","#48C0A3"
"草绿","#40DE5A"
"青色","#00E09E"
"青翠","#00E079"
"青白","#C0EBD7"
"鸭卵青","#E0EEE8"
"蟹壳青","#BBCDC5"
"鸦青","#424C50"
"绿色","#00E500"
"豆绿","#9ED048"
"豆青","#96CE54"
"石青","#7BCFA6"
"玉色","#2EDFA3"
"缥","#7FECAD"
"艾绿","#A4E2C6"
"松柏绿","#21A675"
"松花绿","#057748"
"松花色","#BCE672"
"蓝","#44CEF6"
"靛青","#177CB0"
"靛蓝","#065279"
"碧蓝","#3EEDE7"
"蔚蓝","#70F3FF"
"宝蓝","#4B5CC4"
"蓝灰色","#A1AFC9"
"藏青","#2E4E7E"
"藏蓝","#3B2E7E"
"黛色","#4A4266"
"黛螺","#4A4266"
"黛绿","#426666"
"黛蓝","#425066"
"黛紫","#574266"
"紫色","#8D4BBB"
"紫酱","#815463"
"酱紫","#815476"
"紫檀","#4C221B"
"绀青","#003371"
"紫棠","#56004F"
"青莲","#801DAE"
"群青","#4C8DAE"
"雪青","#B0A4E3"
"丁香色","#CCA4E3"
"藕色","#EDD1D8"
"藕荷色","#E4C6D0"
"苍色","#75878A"
"苍翠","#519A73"
"苍黄","#A29B7C"
"苍青","#7397AB"
"苍黑","#395260"
"苍白","#D1D9E0"
"水色","#88ADA6"
"水红","#F3D3E7"
"水绿","#F3D3E7"
"水蓝","#D2F0F4"
"淡青","#D2F0F4"
"湖蓝","#30DFF3"
"湖绿","#25F8CB"
"精白","#FFFFFF"
"象牙白","#FFFBF0"
"雪白","#F0FCFF"
"月白","#D6ECF0"
"缟","#F2ECDE"
"素","#E0F0E9"
"荼白","#F3F9F1"
"霜色","#E9F1F6"
"鱼肚白","#FCEFE8"
"莹白","#E3F9FD"
"灰色","#808080"
"牙色","#EEDEB0"
"铅白","#F0F0F4"
"玄色","#622A1D"
"玄青","#3D3B4F"
"乌色","#725E82"
"乌黑","#392F41"
"漆黑","#161823"
"墨色","#50616D"
"墨灰","#758A99"
"黑色","#000000"
"缁色","#493131"
"煤黑","#312520"
"黧","#5D513C"
"黎","#75664D"
"黝","#6B6882"
"黝黑","#665757"
"黯","#41555D"
"赤金","#F2BE45"
"金色","#EACD76"
"银白","#E9E7EF"
"铜绿","#549688"
"乌金","#A78E44"
"老银","#BACAC6"
"银朱","#BF242A"
"朱砂","#FF461F"
"朱膘","#FF461F"
"赭石","#845A33"
"石绿","#16A951"
"白粉","#FFF2DF"
"花青","#003472"
"藤黄","#FFB61E"
"雌黄","#FFC64B"
"雄黄","#E9BB1D"
"石黄","#E9BB1D"
相关推荐
1.3 小结 第2章 Android开发环境搭建 2.1 Android开发准备工作 2.2 开发包及其工具的安装和 配置 2.2.1 安装JDK和配置Java开发 环境 2.2.2 Eclipse的安装与汉化 2.2.3 SDK和ADT的安装和 配置 2.3 创建第一个Android...
Android Drawable是Android开发中不可或缺的一部分,它是一种抽象类,用于表示可以在Canvas上绘制的各种图像,通常作为View的背景。Drawable提供了丰富的功能,包括显示图片、纯色、九宫格图以及自定义形状等。 ...
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); window.setOutsideTouchable(true); window.setTouchable(true); ``` 3. 显示PopupWindow。有两种方法可以实现:`showAsDropDown()`和`...
《Android应用开发揭秘》全部实例源代码,配合《Android应用开发揭秘》使用 前言 第一部分 准备篇 第1章 Android开发简介 1.1 Android基本概念 1.1.1 Android简介 1.1.2 Android的系统构架 ... 17.4小结
作者简介 杨丰盛,Android应用开发先驱,对Android有深入研究,实战经验极其丰富。精通Java、C、C++等语言,专注于移动通信软件开发,在机顶盒软件开发和MTK平台软件开发方面有非常深厚的积累。... 17.4小结
内容提要 -------------------------------------------------------------------------------- 国内第一本基于Android 2.0的经典著作,5大专业社区联袂推荐,权威性毋庸置疑!《Android应用开发揭秘》...17.4小结
杨丰盛,Android应用开发先驱,对Android有深入研究,实战经验极其丰富。精通Java、C、C++等语言,专注于移动通信软件开发,在机顶盒软件开发和MTK平台软件开发方面有非常深厚的积累。2007年获得中国软件...17.4小结
1.5小结 第2章搭建你的开发环境 2.1配置前的准备工作 2.1.1 Android支持的操作系统 2.1.2准备“四大法宝” 2.2安装并配置JDK 2.2.1 安装JDK 2.2.2配置JDK 2.3安装并配置Eclipse 2.3.1 运行Eclipse 2.3.2 了解Eclipse...
在Android编程中,图片特效处理是一项...在实际开发中,开发者还可以结合Shader、ColorFilter等高级特性,创造出更多丰富的视觉效果。了解并熟练掌握这些技术,将有助于提升你的Android应用的界面美观性和用户体验。
1.5小结 第2章搭建你的开发环境 2.1配置前的准备工作 2.1.1 Android支持的操作系统 2.1.2准备“四大法宝” 2.2安装并配置JDK 2.2.1 安装JDK 2.2.2配置JDK 2.3安装并配置Eclipse 2.3.1 运行Eclipse 2.3.2 了解Eclipse...
### 小结 通过本文的学习,我们不仅了解了Android中渐变色的基本概念和定义方法,还掌握了如何在实际项目中灵活运用这些技术。希望这些知识点能够帮助你在Android开发中创造出更多美观且实用的应用界面。
#### 五、小结 `Selector`是Android开发中一个非常实用的功能,能够帮助开发者轻松实现界面控件在不同状态下的外观变化。通过对ListView和Button的示例分析,我们了解了如何使用`Selector`来定制控件的背景图像、...
#### 四、小结 通过上述步骤,我们已经在Android应用中成功集成了B站的弹幕系统,并实现了基本的弹幕功能。此外,还可以进一步定制弹幕的样式和行为,如添加动画效果、支持图片弹幕等。希望本文能够帮助您更好地理解...
**1.3 小结** 本章介绍了Android的基本概念、系统构架以及应用程序框架,同时对OPhone和Widget进行了简要说明,为后续的学习打下了基础。 #### 二、Android开发环境搭建 **2.1 Android开发准备工作** - 在开始...
在Android开发中,TextView是用于显示文本的基础组件,但它的功能远不止简单的文字显示。通过一些高级技巧,我们可以实现更丰富的文本展示效果,如自定义字体、多彩文字、加粗字体、添加阴影以及插入图片。下面将...
android:textColor="@color/red" /> ``` 这里的`@color/red`引用了`color.xml`中的`red`颜色资源。 2. **自定义颜色资源**: 如果需要在`color.xml`文件中定义颜色,可以按照以下格式创建: ```xml ...
本文实例讲述了Android编程实现TextView字体颜色设置的方法。分享给大家供大家参考,具体如下: ...关键字: android textview color TextView的字体设置方法: 1、直接通过配置文件设置 2、在Activity
#### 五、小结 通过继承 `TabActivity` 并结合 XML 和 Java 代码的方式,我们可以灵活地创建功能强大的标签式导航界面。这种方法不仅简化了 XML 文件,还提高了代码的可读性和维护性。希望本文能帮助你在Android...