`

Resource-type-->Color State List Resource

阅读更多

Color State List Resource

ColorStateList 可以用XML定义,并且可以用到View文字上。

 

文件存放位置:

 res/color/filename.xml

 

语法:

 

<?xml version="1.0" encoding="utf-8"?><selectorxmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:color="hex_color"
        android:state_pressed=["true" | "false"]
        android:state_focused=["true" | "false"]
        android:state_selected=["true" | "false"]
        android:state_checkable=["true" | "false"]
        android:state_checked=["true" | "false"]
        android:state_enabled=["true" | "false"]
        android:state_window_focused=["true" | "false"] /></selector>

例子:

 

定义,/res/color/button_text_color.xml

 

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
          android:color="#ffff0000"/> <!-- pressed -->
    <item android:state_focused="true"
          android:color="#ff0000ff"/> <!-- focused 在键盘手机上才会显示效果 --> 
    <item android:color="#ff000000"/> <!-- default -->
</selector>


应用:

 

 

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/button_text"
    android:textColor="@color/button_text_color" />



 

 

 

 

0
5
分享到:
评论

相关推荐

    struts_2.3.12GA_API文档(chm版本)

    public void setFieldErrors(Map,List&lt;String&gt;&gt; errorMap)从接口 ValidationAware 复制的描述 Set the field error map of fieldname (String) to Collection of String error messages. 指定者: 接口 ...

    Windows Server 2003 Resource Kit Tools

    Windows Server 2003 Resource Kit Tools 其中包括的工具有: Acctinfo.dll (documented in Readme.htm) Adlb.exe: Active Directory Load Balancing Tool,AD负载均衡 Admx.msi: ADM File Parser,ADM文件解析 ...

    Diskeeper 2008 v12.0.759.0

    manual and resource-intensive process. Frag Shield抯 MFT fragmentation prevention technology is now fully automatic and re-written to operate invisibly using InvisiTasking technology. o ...

    gc2145_tinav2.1验证完成20170523_1648.7z

    dev-&gt;early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1; dev-&gt;early_suspend.suspend = vfe_early_suspend; dev-&gt;early_suspend.resume = vfe_late_resume; // [hawkview_err]xxxxcan't open /dev/...

    Visual C++ 编程资源大全(英文源码 控件)

    06.zip&lt;br&gt;Combobox Color Picker &lt;br&gt;选择颜色的ComboBox(6KB)&lt;END&gt;&lt;br&gt;7,07.zip&lt;br&gt;Switch between drop down & drop list mode &lt;br&gt;处理drop down和drop list方式之间的转换(32KB)&lt;END&gt;&lt;br&gt;8,08.zip&lt;br&gt;Drop down...

    Visual C++ 编程资源大全(英文源码 其它)

    1,01.zip&lt;br&gt;Output&lt;br&gt;显示所有的调试信息(5KB)&lt;END&gt;&lt;br&gt;2,02.zip&lt;br&gt;Some general debugging tips&lt;br&gt;一般的调试技巧(11KB)&lt;END&gt;&lt;br&gt;3,03.zip&lt;br&gt;Debugging ISAPI extension&lt;br&gt;调试ISAPI扩展(4KB)&lt;END&gt;&lt;br&gt;4,04....

    Inside ASP.NET

    .NET Resource List ASP.NET Web Hosting Sites ASP.NET Web Sites C# Web Sites Visual Basic .NET Web Sites .NET Web Sites XML Web Services Microsoft .NET Websites Microsoft .NET ...

    servlet2.4doc

    A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both. Filters perform filtering in the ...

    VoIP Demo源码演示

    Note: Only showing participant and session state change events. 1. MainWndProc - User selects to make a call to a buddy / SIP URI 2. MainWndProc - Does some error checking, URI formatting if ...

    IRPTrace2.00.002.zip

    IOCTL_VIDEO_GET_OUTPUT_DEVICE_POWER_STATE IOCTL_VIDEO_ENUM_MONITOR_PDO IOCTL_VIDEO_INIT_WIN32K_CALLBACKS IOCTL_VIDEO_IS_VGA_DEVICE IOCTL_VIDEO_MAP_VIDEO_MEMORY IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES ...

    ExpressBars Suite 6.34 + source code

    (Screen Shot)&lt;br&gt; * Load and Save State - With the ExpressBars, you can load and save Bar state to an INI file, to the Windows Registry and to a stream.&lt;br&gt; * Detachable Sub-Menus - ExpressBars ...

    CompTIA.Linux.LPIC-1.Cert.Guide.07897545

    The most comprehensive and time-efficient LPIC-1 study guide available, it's an extraordinarily cost-effective alternative to expensive training: a perfect resource for all LPIC-1 candidates....

    rx第三方控件

    User can type data into an edit box or can bring up dialog or popup window by clicking a button. TMemoryTable implements BDE in-memory table as a dataset component (with Delete operation). ...

    EurekaLog_7.5.0.0_Enterprise

    24)..Added: EResLeaks improvements (new funcs: ResourceAdd, ResourceDelete, ResourceName; support for realloc-like functions) 25)..Fixed: Added workaround for bug in JIRA 5.x 26)..Fixed: Rare ...

    RxLib控件包内含RxGIF,全部源码及DEMO

    User can type data into an edit box or can bring up dialog or popup window by clicking a button. TMemoryTable implements BDE in-memory table as a dataset component (with Delete operation). ...

    XML轻松学习手册--XML肯定是未来的发展趋势,不论是网页设计师还是网络程序员,都应该及时学习和了解

    4.&lt; font color="red"&gt;samplar&lt; /font&gt;  另外,XML标记必须遵循下面的命名规则: 1.名字中可以包含字母、数字以及其它字母; 2.名字不能以数字或"_" (下划线) 开头; 3.名字不能以字母 xml (或 XML 或 Xml ..)...

    Delphi7.1 Update

    Cannot access field &lt;fieldname&gt; as type variant.&quot; * TClientDataSet doesn‘t save data to file when FileName is set and there is no existing file on disk (Quality Central 2307). * Using the Delphi...

    微软内部资料-SQL性能优化3

    The resource type has the following resource block format: Resource Type (Code) Content DB (2) Data 1: sub-resource; Data 2: 0; Data 3: 0 File (3) Data 1: File ID; Data 2: 0; Data 3: 0 Index (4) Data ...

    Single Carrier FDMA -- A NEW AIR INTERFACE FOR LONG TERM EVOLUTION

    4.7 Appendix – List of 3GPP LTE Standards 78 Contents vii 5 Channel Dependent Scheduling 83 5.1 Introduction 83 5.2 SC-FDMA Performance Measures 88 5.3 Scheduling Algorithms 91 5.4 Channel Models ...

    一个win32下的ARM开源编译器

    &lt;no opcode&gt; | add r0,r1 ;only available inside an IT block, or | ;as 32-bit T2 instruction add r8,r1 | add r8,r1 ;high register used, does not update PSR adds r8,r1 | adds r8,r1 ;only available...

Global site tag (gtag.js) - Google Analytics