Android开源:Calendar - 仿小米 华为 滴答清单 365日历(农历)
TaylahCadle
8年前
<h2>简介</h2> <p>由于项目的需求,研究了众多日历软件。本软件是一款高仿小米、华为、滴答清单、365、钉钉等的自定义日历控件,周月视图平滑滚动,平滑切换,可以在xml文件中进行属性的配置定制,内部切入了RecyclerView,实现日历与列表的无缝连接。</p> <p>主要的优点:</p> <p>1:完全自定义,原理简单,扩展性极强</p> <p>2:支持平滑切换和快速滑动</p> <p>3:支持农历和阴历</p> <p>4:可每周滑动,也可每月滑动</p> <p>5:定期维护,嘻嘻</p> <p>不多废话,上图:</p> <p style="text-align:center"><img src="https://simg.open-open.com/show/27c6c7a84db97a47fd471a9ed5fc2136.gif"></p> <p>具体的使用教程如下</p> <p>首先:需要把我们的工程以module的形式导入您的工程</p> <p>其次:在xml文件中添加如下代码,具体的配置参考我们的demo</p> <pre> <code class="language-java"><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></code></pre> <h3>MonthCalendarView的使用说明</h3> <pre> <code class="language-java"><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"/></code></pre> <h3>ScheduleLayout的使用说明</h3> <p>layout_schedule.xml文件,必须包含MonthCalendarView、WeekCalendarView和ScheduleRecyclerView,可以直接引用改文件作为布局。<br/></p> <p>ScheduleLayout:</p> <p>app:default_view="week" <!-默认周视图-></p> <p>app:default_view="month" <!-默认月视图-></p> <h3>设置日期监听</h3> <pre> <code class="language-java">slSchedule.setOnCalendarClickListener(new OnCalendarClickListener() { @Override public void onClickDate(int year, int month, int day) { //监听获得点击的年月日 } });</code></pre> <h3>跳转到今天</h3> <pre> <code class="language-java">slSchedule.getMonthCalendar().setTodayToView();</code></pre> <h2> </h2> <p> </p> <p> </p>