zoukankan      html  css  js  c++  java
  • 每日总结

    今天继续学习Android的复选框

    今天实现了复选框的自定义点击效果

    实现效果图如下:

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item
            android:state_enabled="true"
            android:state_checked="true"
            android:drawable="@mipmap/ic_checkbox_checked"/>
        <item
            android:state_enabled="true"
            android:state_checked="false"
            android:drawable="@mipmap/ic_checkbox_normal" />
    </selector>

    写好后,我们有两种方法设置

    ①android:button属性设置为上述的selctor

    android:button="@drawable/rad_btn_selctor"

    ②在style中定义一个属性,然后通过android style属性设置,先往style添加下述代码:

        <style name="MyCheckBox" parent="@android:style/Widget.CompoundButton.CheckBox">
            <item name="android:button">@drawable/rad_btn_selctor</item>
        </style>

    然后布局那里:

    style="@style/MyCheckBox"
  • 相关阅读:
    随笔练习
    获得屏幕相关的辅助类
    C# 下sqlite简单使用
    XP系统下 VS2010 选中行崩溃
    Custome Buble Data Point
    RIA
    Chart Style
    d3js
    TreeView
    [Java入门笔记] Java语言简介
  • 原文地址:https://www.cnblogs.com/lxywsx/p/14909355.html
Copyright © 2011-2022 走看看