点击爱心收藏

第一步:

创建一个选择器:

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

    <item android:drawable="@drawable/add_keep" android:state_checked="false"/>
    <item android:drawable="@drawable/video_is_follow_icon" android:state_checked="true"/>
</selector>

第二步:

在布局里添加CheckBox控件

<CheckBox
            android:layout_alignParentRight="true"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:layout_below="@id/home_tv"
            android:layout_marginTop="30dp"
            android:button="@null"
            android:background="@drawable/selector"
            />
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。