一个类似于进度和打卡进度的自定义view
如下图:
之前写过一个可以双向滑动的和这个view的类似,那个滑动的view处理的onTouch事件,以及判断了我们应该滑动哪个小球,有兴趣的可以看下之前的连接 双向滑动的SeekBar:http://blog.csdn.net/givemeacondom/article/details/52397589
这个就比较简单了,都是静态的绘制,唯一的交互就是UI中的签到按钮,点击一次通知自定义view绘制;
上面就是实现的思路,我们一步步看下代码,最后会奉上源代码的下载链接;
<declare-styleable name="SignInView"> <attr name="sign_in_bg_clor" format="color" />
<attr name="sign_in_pb_clor" format="color" />
<attr name="sign_in_check_clor" format="color" />
<attr name="sign_in_text_clor" format="color" />
<attr name="sign_in_text_size" format="dimension" />
</declare-styleable>
根据需求我们的这个view默认充满屏幕,所以只需要处理height的测量模式即可
重要的在这里,源代码下载地址
https://github.com/GuoFeilong/BehivorDemo