zoukankan      html  css  js  c++  java
  • selector的例子

    例子1

    文件名:sl_rounded_rectangle_button_picture.xml

    文件内容:

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/ic_btn_click" android:state_pressed="true"/>
    <item android:drawable="@drawable/ic_btn_normal" android:state_enabled="false"/>
    <item android:drawable="@drawable/ic_btn_normal"/>

    </selector>



    例子2
    主文件:sl_rounded_rectangle_button.xml

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/bg_rounded_rectangle_button_p" android:state_pressed="true"/>
    <item android:drawable="@drawable/bg_rounded_rectangle_button_en" android:state_enabled="false"/>
    <item android:drawable="@drawable/bg_rounded_rectangle_button_n"/>

    </selector>

    例子2 辅助文件
    bg_rounded_rectangle_button_p
    .xml
    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="@color/common_btn_press_color" />

    <corners
    android:bottomLeftRadius="10dp"
    android:bottomRightRadius="10dp"
    android:topLeftRadius="10dp"
    android:topRightRadius="10dp" />

    </shape>


    例子2 辅助文件
    bg_rounded_rectangle_button_en.xml
    
    
    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="@color/common_btn_normal_color" />

    <corners
    android:bottomLeftRadius="5dp"
    android:bottomRightRadius="5dp"
    android:topLeftRadius="5dp"
    android:topRightRadius="5dp" />

    </shape>

    例子2 辅助文件
    bg_rounded_rectangle_button_n.xml
    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="@color/common_btn_normal_color" />

    <corners
    android:bottomLeftRadius="5dp"
    android:bottomRightRadius="5dp"
    android:topLeftRadius="5dp"
    android:topRightRadius="5dp" />

    </shape>
    
    
     
     



     
  • 相关阅读:
    Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) C. Success Rate
    Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) B. T-Shirt Hunt
    go 读取数据库所有表数据显示到网页(便于测试时看)
    go 文件上传
    go 文件服务(读取须权限)
    vps git无法clone DNS解析错误
    go 自己封的postgresql连接池操作包
    看 迪杰斯特拉(Dijsktra)算法体会
    Floyd算法(弗洛伊德算法) 百度百科
    Constructing Roads In JGShining's Kingdom
  • 原文地址:https://www.cnblogs.com/YangBinChina/p/6755789.html
Copyright © 2011-2022 走看看