博主介绍:本人专注于Android/java/数据库/微信小程序技术领域的开发,以及有好几年的计算机毕业设计方面的实战开发经验和技术积累;尤其是在安卓(Android)的app的开发和微信小程序的开发,很是熟悉和了解;本人也是多年的Android开发人员;希望我发布的此篇文件可以帮助到您;
🍅点个关注不迷路!🍅
目录
效果演示
一、Gradle配置
dependencies { implementation 'com.necer.ncalendar:ncalendar:4.0.2' implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:recyclerview-v7:27.1.1' }
二、xml布局文件配置
<com.necer.calendar.EmuiCalendar android:id="@+id/emuiCalendar" android:layout_width="match_parent" android:layout_height="match_parent" app:holidayColor="#F29B38" app:isShowLunar="true" app:isDefaultSelect="false" app:lunarHolidayTextColor="#F29B38" app:pointDistance="15dp" app:pointColor="#f00" app:selectCircleColor="@color/main_color" app:solarHolidayTextColor="#F29B38" app:solarTermTextColor="#F29B38" app:todaySolarTextColor="#F29B38"> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/tv_lunar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="15dp" android:background="#f5f5f5" android:textColor="#333333" android:textSize="13sp" /> </android.support.v4.widget.NestedScrollView> </com.necer.calendar.EmuiCalendar>
三、日历添加小圆点
List<String> pointList = Arrays.asList("2004-01-01", "2004-01-02"); InnerPainter innerPainter = (InnerPainter) miui10Calendar.getCalendarPainter(); innerPainter.setPointList(pointList);效果如图:
四、点击事件
emuiCalendar.setOnCalendarChangedListener(new OnCalendarChangedListener() { @Override public void onCalendarChange(BaseCalendar baseCalendar, int year, int month, LocalDate localDate) { tv_result.setText(year + "年" + month + "月" + " 当前选中 " + localDate); listSchedulChoice(false,localDate.toString()); } });说明:emuiCalendar是日历控件信息
五、支持的属性
Attributes forma describe solarTextColor color 公历日期的颜色 lunarTextColor color 农历日期的颜色 solarHolidayTextColor color 公历节假日的颜色 lunarHolidayTextColor color 农历节假日的颜色 solarTermTextColor color 节气颜色 selectCircleColor color 选中圈的颜色 holidayColor color 法定节休息日颜色 workdayColor color 法定节调休工作日颜色 bgEmuiCalendarColor color Emui日历的背景 bgChildColor color 日历包含子view的背景 todaySelectContrastColor color 今天被选中是其他元素的对比色,比如 农历,圆点等 pointColor color 小圆点的颜色 startDate string 日期区间开始日期 endDate string 日期区间结束日期 isDefaultSelect boolean 是否默认选中 isDefaultSelectFitst boolean 是否默认翻页选中第一天 isMultipleSelect boolean 是否多选 alphaColor integer 不是本月的日期颜色的透明度0-255 disabledAlphaColor integer 日期区间之外的地日颜色的透明度0-255 disabledString string 点击日期区间之外的日期提示语 todaySolarTextColor color 今天不选中的颜色 todaySolarSelectTextColor color 今天选中的颜色 selectCircleRadius dimension 选中圈的半径 solarTextSize dimension 公历日期字体大小 lunarTextSize dimension 农历日期字体大小 lunarDistance dimension 农历日期到公历字体的距离 holidayTextSize dimension 法定节假日字体的大小 holidayDistance dimension 法定节假日到公历的距离 pointDistance dimension 小圆点到公历的距离 hollowCircleStroke dimension 空心圆的宽度 calendarHeight dimension 日历的高度 duration integer 日历自动滑动的时间 isShowLunar boolean 是否显示农历 isShowHoliday boolean 是否显示法定节假日 isWeekHold boolean 周状态是否固定,默认不固定 isDefaultSelect boolean 是否默认选中(只对单个月日历或者周日历有效) defaultCalendar enum 默认视图 week 或者 month pointLocation enum 指示点的文职 up(在公历的上方) 或者 down(在公历的下方) 默认是up firstDayOfWeek enum 一周开始的星期天还是星期一 sunday 或者 monday 默认是sunday holidayLocation enum 法定节假日相对公历日期的位置 top_right(右上方)、top_left(左上方)、bottom_right(右下方)、bottom_left(左下方)
关注点赞
大家点赞、收藏、关注、评论啦 、查看👇🏻👇🏻👇🏻获取联系方式👇🏻👇🏻👇🏻