Android開源:Calendar - 仿小米 華為 滴答清單 365日歷(農歷)
簡介
由于項目的需求,研究了眾多日歷軟件。本軟件是一款高仿小米、華為、滴答清單、365、釘釘等的自定義日歷控件,周月視圖平滑滾動,平滑切換,可以在xml文件中進行屬性的配置定制,內部切入了RecyclerView,實現日歷與列表的無縫連接。
主要的優點:
1:完全自定義,原理簡單,擴展性極強
2:支持平滑切換和快速滑動
3:支持農歷和陰歷
4:可每周滑動,也可每月滑動
5:定期維護,嘻嘻
不多廢話,上圖:
具體的使用教程如下
首先:需要把我們的工程以module的形式導入您的工程
其次:在xml文件中添加如下代碼,具體的配置參考我們的demo
<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>
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,可以直接引用改文件作為布局。<br/>
ScheduleLayout:
app:default_view="week" <!-默認周視圖->
app:default_view="month" <!-默認月視圖->
設置日期監聽
slSchedule.setOnCalendarClickListener(new OnCalendarClickListener() {
@Override
public void onClickDate(int year, int month, int day) {
//監聽獲得點擊的年月日
}
});
跳轉到今天
slSchedule.getMonthCalendar().setTodayToView();
本文由用戶 TaylahCadle 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!