zoukankan      html  css  js  c++  java
  • 安德鲁斯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一直是默认状态。而无法获得焦点的情况           

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

  • 相关阅读:
    Educational Codeforces Round 74 (Rated for Div. 2)
    Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1) 题解
    D
    Card Hand Sorting 二进制枚举暴力
    20172018-acmicpc-southeastern-european-regional-programming-contest-seerc-2017-en A
    Round #590 (Div. 3)
    A
    P2634 [国家集训队]聪聪可可
    HDU-4807-Lunch Time(二分+费用流,思维)
    易错分析
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/4722355.html
Copyright © 2011-2022 走看看