如何在android CalendarView中显示json响应?

时间:2016-11-29 10:49:24

标签: android datetime android-calendar android-json calendarview

我在Android应用程序中有一个MaterialCalendarView,我有一个像这样的json响应:

{"Table":
[
{"userid":4,"eventname":"Aditya","eventdate":"\/Date(1479974400000-0800)\/","eventcolor":"5986FF","autoid":1011},
{"userid":4,"eventname":"dfgdgdgs","eventdate":"\/Date(1478678400000-0800)\/","eventcolor":"AD3D1F","autoid":1005},
{"userid":4,"eventname":"dfgdgdgs","eventdate":"\/Date(1478678400000-0800)\/","eventcolor":"AD3D1F","autoid":1006}
]
}

如何在我们的calendarView中各自的日期显示此JSON响应?

1 个答案:

答案 0 :(得分:2)

对于可以使用此库进行滚动的完全feldged日历:MaterialCalenderView

使用此lib获取一个水平日历视图.U可以使用装饰器在日期下显示点,当您点击它时,您可以使用recylerview或其他东西来列出事件。

搜索装饰器,你可以在该库中使用wth日期。

materialCalendarView.setDateTextAppearance()
materialCalendarView.addDecorator(new OpenSansDecorator(getActivity())); 
materialCalendarView.setHeaderTextAppearance(R.style.TextAppearance_ProfileCalenderHeader);
materialCalendarView.setDateTextAppearance(R.style.TextAppearance_ProfileCalenderCurrentDate);           
materialCalendarView.setWeekDayTextAppearance(R.style.TextAppearance_ProfileCalenderHeader);

styles.xml

<style name="TextAppearance.ProfileCalenderDate" parent="android:TextAppearance">
        <!--<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>-->
        <item name="android:textSize">@dimen/text_size_small</item>
        <item name="android:textColor">@drawable/calender_selection_drawable</item>
    </style>

    <style name="TextAppearance.ProfileCalenderCurrentDate" parent="android:TextAppearance">
        <!--<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>-->
        <item name="android:textSize">@dimen/text_size_small</item>
        <item name="android:textColor">@drawable/calendar_cur_slection_drawable</item>
    </style>