仿小米、华为、滴答清单、365、钉钉自定义日历

原文简书地址(http://www.jianshu.com/p/7a3f0a37e0ef

简介

由于项目的需求,研究了众多日历软件。本软件是一款高仿小米、华为、滴答清单、365、钉钉等的自定义日历控件,周月视图平滑滚动,平滑切换,可以在xml文件中进行属性的配置定制,内部切入了RecyclerView。

主要的优点:

1:完全自定义,原理简单,可扩展性强
2:支持平滑切换和快速滑动
3:支持农历和阴历
4:可每周滑动,也可每月滑动
5:定期维护,嘻嘻

不多废话,上图:

具体的使用教程如下(在xml文件中添加如下代码)
      <com.jeek.calendar.widget.calendar.schedule.ScheduleLayout
            android:id="@+id/slSchedule"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:default_view="week">

           <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <RelativeLayout
                        android:id="@+id/rlMonthCalendar"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                        <com.jeek.calendar.widget.calendar.month.MonthCalendarView
                            android:id="@+id/mcvCalendar"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/month_calendar_height"
                            android:background="@color/colorWrite"
                            android:overScrollMode="never"
                            app:month_day_text_size="@integer/calendar_text_size"
                            app:month_hint_circle_color="@color/bg_color"
                            app:month_selected_circle_color="@color/bg_color_1"
                            app:month_selected_circle_today_color="@color/bg_color"
                            app:month_today_text_color="@color/bg_color" />
                    </RelativeLayout>

                    <com.jeek.calendar.widget.calendar.week.WeekCalendarView
                        android:id="@+id/wcvCalendar"
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/week_calendar_height"
                        android:background="@color/colorWrite"
                        android:overScrollMode="never"
                        android:visibility="visible"
                        app:week_day_text_size="@integer/calendar_text_size"
                        app:week_hint_circle_color="@color/bg_color"
                        app:week_selected_circle_color="@color/bg_color_1"
                        app:week_selected_circle_today_color="@color/bg_color"
                        app:week_today_text_color="@color/bg_color" />

                </RelativeLayout>

                <RelativeLayout
                    android:id="@+id/rlScheduleList"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@color/colorBackground">

                    <com.jeek.calendar.widget.calendar.schedule.ScheduleRecyclerView
                        android:id="@+id/rvScheduleList"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentStart="true"
                        android:layout_alignParentTop="true"
                        android:orientation="vertical">

                    </com.jeek.calendar.widget.calendar.schedule.ScheduleRecyclerView>

                </RelativeLayout>

            </LinearLayout>

        </com.jeek.calendar.widget.calendar.schedule.ScheduleLayout>

MonthCalendarView的使用

    <com.jeek.calendar.widget.calendar.month.MonthCalendarView
              android:id="@+id/mcvCalendar"
              android:layout_width="match_parent"
              android:layout_height="@dimen/small_month_calendar_height"
                app:month_day_text_size="@integer/small_calendar_text_size"
                app:month_selected_circle_color="@color/color_select_date_dialog_edit_text_bg_focus"
                app:month_selected_circle_today_color="@color/color_select_date_dialog_edit_text_bg_focus"
                app:month_show_lunar="true" <!-是否显示农历,默认显示->
                app:month_show_task_hint="false" <!-是否显示圆点提示->
                app:week_text_size="@integer/small_calendar_text_size"/>

ScheduleLayout的使用

layout_schedule.xml文件,必须包含MonthCalendarView、WeekCalendarView和ScheduleRecyclerView,可以直接引用改文件作为布局。

ScheduleLayout:
app:default_view=”week”

设置日期监听

    slSchedule.setOnCalendarClickListener(new OnCalendarClickListener() {
                @Override
                public void onClickDate(int year, int month, int day) {
                    //监听获得点击的年月日
                }
            });

跳转到今天

    slSchedule.getMonthCalendar().setTodayToView();

备注:

在xml文件里可以直接设置选中天的背景的颜色,是否要显示农历,今天的颜色等。
源码地址,好用的话,记得star哦!
源码地址,好用的话,记得star哦!
源码地址,好用的话,记得star哦!
重要的事儿说三遍,谢谢!!!!!!

联系我们:

小江Android交流群(259194144),进群备注Android、Github、简书之类的关键词即可。

  • 2
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值