2016-11-07 67 views
0

我膨脹的簡單CalendarView:安卓:(CalendarView)無法更改月,選擇日期

<CalendarView 
    android:id="@+id/calendar_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    style="@android:style/Widget.CalendarView" 
    android:focusedMonthDateColor="@android:color/primary_text_dark" 
    android:unfocusedMonthDateColor="@color/light_gray"/> 

在我的測試設備時,我儘量選擇比當前日期以外的任何日期或更改月份滾動,沒有任何反應

我錯過了什麼嗎?

回答

0

我會建議你使用https://github.com/wdullaer/MaterialDateTimePicker

這是爲Android高度可定製CalendarView並具有良好的文檔。 非常容易使用我在大多數項目中使用它。

+0

謝謝,但我需要將日曆作爲屏幕的一部分,而不是對話框。這就是爲什麼選擇了CalendarView。 –

+0

您應該從您的日曆視圖中分配一個onDateChange偵聽器,並將其更改爲您的CalendarView上的日期 –