android 日历选择控件

近期项目有做日历选择控件需求,综合各种自己实现耗时耗力bug多、很多封装好的无法满足项目需求等因素,在这里分享一篇成熟的第三方日历选择控件博客

gradle添加

compile ‘com.haibin:calendarview:3.3.1’

xml文件
SimpleMonthView和SimpleWeekView文件,博主博客项目链接里面有,直接复制就好了

<com.haibin.calendarview.CalendarView
        android:id="@+id/calendarview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/shape_calendar_dialog"
        app:calendar_height="46dp"
        app:current_month_lunar_text_color="#CFCFCF"
        app:current_month_text_color="@color/colorTextGray"
        app:min_year="2004"
        app:month_view="per.chen.demo.calendardialog.SimpleMonthView"
        app:other_month_text_color="#e1e1e1"
        app:scheme_text_color="@color/colorTextGray"
        app:scheme_theme_color="@color/colorTheme"
        app:selected_text_color="#fff"
        app:selected_theme_color="@color/colorTheme"
        app:week_background="#fff"
        app:week_text_color="@color/colorTextPre"
        app:week_view="per.chen.demo.calendardialog.SimpleWeekView"
        app:year_view_day_text_color="@color/colorTextGray"
        app:year_view_day_text_size="9sp"
        app:year_view_month_text_color="@color/colorTheme"
        app:year_view_month_text_size="20sp"
        app:year_view_scheme_color="@color/colorTheme" />

这个自定义控件很多属性都可以设置,我自己重复造轮子,把这个封装到一个Dialog里面,使用的时候直接调用,非常方便
附上图片

这里写图片描述

参考于:https://blog.csdn.net/huanghaibin_dev/article/details/79040147
感谢作者分享~

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值