• 安德鲁斯Selector简介


    <?

    xml version="1.0" encoding="utf-8"?

    > <selector xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 默认情况,item必须放在最后 --> <!-- 非触摸模式下获得焦点并单击时的背景图片 --> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ic_launcher" /> <!-- 触摸模式下单击时的背景图片--> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/ic_launcher" /> <!--选中时的图片背景--> <item android:state_selected="true" android:drawable="@drawable/ic_launcher" /> <!--获得焦点时的图片背景--> <item android:state_focused="true" android:drawable="@drawable/ic_launcher" /> <item android:drawable="@drawable/button_bg_default" /> </selector>

    4.android:state_active="true/false"
    true:表示可勾选状态时使用,false:表示不可勾选状态下使用
    5. android:state_checkable="true/false"
    true:表示勾选状态下使用。false:表示非勾选状态使用
    6.android:state_checked="true/false"
    true:表示勾选状态下使用。false:表示非勾选状态使用
    7. android:state_enabled="true/false"
    true:表示可用状态使用(能接收触摸/点击事件)。false:表示不可用状态使用
    8. android:state_window_focused="true/false"
    true:表示应用程序窗体有焦点时使用(应用程序在前台),false:表示无焦点时使用




    注意:

    1、<!-- 默认情况,item必须放在最后 -->

    This item is unreachable because a previous item (item #1) is a more general match than this one     

    不然会出现就是说第二行item之前。不能有元素出现。假设这样放置,会出现button一直是默认状态。而无法获得焦点的情况           

    版权声明:本文博客原创文章,博客,未经同意,不得转载。

  • 相关阅读:
    python读取 ini 配置文件
    Mysql 存储过程声明及使用
    PAT乙级1002
    Pat乙级1001
    第四届蓝桥杯省赛翻硬币
    蓝桥杯第四届省赛错误票据
    蓝桥杯第四届省赛前缀判断
    蓝桥杯第四届省赛第39级台阶
    蓝桥杯第四届省赛马虎的算式
    蓝桥杯第三届省赛试题取球游戏
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/4722355.html
Copyright © 2020-2023  润新知