Files
lvgl/examples/widgets/calendar/lv_example_calendar_2.c
2024-04-08 14:06:22 +02:00

33 lines
918 B
C

#include "../../lv_examples.h"
#if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE && LV_BUILD_EXAMPLES
void lv_example_calendar_2(void)
{
lv_obj_t * calendar = lv_calendar_create(lv_screen_active());
lv_obj_set_size(calendar, 300, 300);
lv_obj_align(calendar, LV_ALIGN_TOP_MID, 0, 0);
lv_calendar_set_today_date(calendar, 2024, 03, 22);
lv_calendar_set_showed_date(calendar, 2024, 03);
#if LV_USE_CALENDAR_HEADER_DROPDOWN
lv_calendar_header_dropdown_create(calendar);
#elif LV_USE_CALENDAR_HEADER_ARROW
lv_calendar_header_arrow_create(calendar);
#endif
lv_calendar_set_chinese_mode(calendar, true);
lv_obj_set_style_text_font(calendar, &lv_font_simsun_14_cjk, LV_PART_MAIN);
}
#else
void lv_example_calendar_2(void)
{
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "chinese calendar is not enabled");
lv_obj_center(label);
}
#endif