【发布时间】:2018-06-22 12:48:03
【问题描述】:
我正在使用 CalendarPickerView 从日历中选择多个日期。我可以制作日历,但发生的事情是,我只能看到日历的一个月(在我的情况下是当前月份)。没有更多的月份可见。我不明白这个问题。我已经尝试了多段代码,但我仍然只看到日历的一个月。如何向用户显示我提供的一年中的所有月份(1 年)?
截图:
布局:
<com.squareup.timessquare.CalendarPickerView
android:id="@+id/calendar_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarStyle="outsideOverlay"
android:clipToPadding="false"
android:background="#FFFFFF"
android:layout_alignParentTop="true"
android:layout_above="@+id/btn_show_dates"/>
Activity的OnCreate中的代码:
final CalendarPickerView calendar_view =
findViewById(R.id.calendar_view);
Calendar nextYear = Calendar.getInstance();
nextYear.add(Calendar.YEAR, 1);
Date today = new Date();
calendar_view
.init(today, nextYear.getTime())
.inMode(CalendarPickerView.SelectionMode.MULTIPLE)
.withSelectedDate(today);
我也在 ScrollView 中添加了布局,我认为这是一些可见性问题,但没有任何效果。
【问题讨论】:
-
This is a fairly large control so it is wise to give it ample space in your layout. On small devices it is recommended to use a dialog, full-screen fragment, or dedicated activity.来自其文档。 -
我使活动上的所有其他组件的可见性都消失了,仍然没有成功!
-
在对话框中添加日历布局有效。谢谢!
标签: android datepicker calendar