android switch控件

<Switch
        android:layout_width="wrap_content"
        android:layout_height="@dimen/minCellHeight"
        android:checked="true"
        android:button="@null"
        android:thumb="@null"
        android:background="@drawable/switch_btn"/>

 

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

 

 

效果图就是图片的效果,以上图片可以直接拿来用

android:thumb="@null"这句功能只要是屏蔽android自带的效果图片
posted @ 2018-08-08 09:50  新年新气象  阅读(184)  评论(0编辑  收藏  举报