Hello CalendarView —— 日历使用
一个很棒很漂亮的日历,感谢作者的开源。
https://github.com/huanghaibin-dev/CalendarView
记录下第一次使用的注意事项
1、在module中添加相关依赖
implementation 'com.haibin:calendarview:3.4.8'
implementation 'com.github.bumptech.glide:glide:3.7.0'
//noinspection GradleDependency
implementation 'com.android.support:appcompat-v7:27.1.1'
//noinspection GradleDependency
implementation 'com.android.support:design:27.1.1'
2、添加资源文件 values/attrs.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="GroupRecyclerView">
<attr name="group_height" format="dimension" />
<attr name="group_child_offset" format="dimension" />
<attr name="group_background" format="color" />
<attr name="group_text_color" format="color" />
<attr name="group_text_size" format="dimension" />
<attr name="group_center" format="boolean" />
<attr name="group_padding_left" format="dimension" />
<attr name="group_padding_right" format="dimension" />
<attr name="group_has_header" format="boolean" />
</declare-styleable>
</resources>
3、如果仅使用日历,不用滑动收缩,则在布局文件添加
<com.haibin.calendarview.CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
app:month_view="com.haibin.calendarviewproject.simple.SimpleCalendarCardView"
app:week_view="com.haibin.calendarviewproject.simple.SimpleWeekView"
app:week_bar_view="com.haibin.calendarviewproject.EnglishWeekBar"
app:calendar_height="50dp"
app:current_month_text_color="#333333"
app:current_month_lunar_text_color="#CFCFCF"
app:min_year="2004"
app:other_month_text_color="#e1e1e1"
app:scheme_text="假"
app:scheme_text_color="#333"
app:scheme_theme_color="#333"
app:selected_text_color="#fff"
app:selected_theme_color="#333"
app:week_start_with="mon"
app:week_background="#fff"
app:month_view_show_mode="mode_only_current"
app:week_text_color="#111" />
特别的,请注意不要复制这三个路径,自行替换您自己的自定义路径
app:month_view="com.haibin.calendarviewproject.simple.SimpleCalendarCardView"
app:week_view="com.haibin.calendarviewproject.simple.SimpleWeekView"
app:week_bar_view="com.haibin.calendarviewproject.EnglishWeekBar"
详情见 github
结束。