这是这个问题的后续问题:
安卓。 CalendarView...一次仅显示一个月的日历 https://stackoverflow.com/questions/33810905/android-calendarview-show-only-one-month-calendar-at-a-time
我正在为一个片段创建一个布局,其中包含CalenderView
<CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
问题在于,从设计角度来看,CalenderView
似乎就像我想要的那样 - 显示单个月份,并在月份名称的顶部左侧和右侧显示导航箭头,以便在月份之间导航。然而,在设备本身中,CalenderView
只是一个很长的月份列表..就像花了几个月的时间才将列表分解到整个屏幕上一样。
如何将其限制为仅 1 个月,并且还可以选择浏览月份?
限制高度“有点”是有效的,因为它确实限制了列表,但仍然不会有导航按钮,并且设置恒定高度是我不喜欢做的事情。
Calendar febFirst=Calendar.getInstance();
febFirst.set(2017, 1, 1, 0, 0, 0);
calendar.setMinDate(febFirst.getTimeInMillis());
Calendar febLast=Calendar.getInstance();
febLast.set(2017, 2, 0, 0, 0, 0);
calendar.setMaxDate(febLast.getTimeInMillis());
calendar.setDate(febFirst.getTimeInMillis());
where calendar is the CalendarView.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)