您当前的位置: 首页 >  ar

仙剑情缘

暂无认证

  • 0浏览

    0关注

    333博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

calendar for litter vGL

仙剑情缘 发布时间:2020-02-18 11:09:11 ,浏览量:0

  • 日期选择回调函数
void calendar_event_handler(lv_obj_t* obj, lv_event_t event) 
{
    if (event == LV_EVENT_CLICKED)
    {
        lv_calendar_date_t* date = lv_calendar_get_pressed_date(obj);
        if (date)
        {
            lv_calendar_set_today_date(obj, date);
        }
    }
}
  • 日历实现

void lv_ex_calendar_1(void) 
{
    lv_obj_t* calendar = lv_calendar_create(lv_scr_act(), NULL);
    lv_obj_set_size(calendar, 230, 230);
    lv_obj_align(calendar, NULL,LV_ALIGN_CENTER, 0, 0);
    lv_obj_set_event_cb(calendar, calendar_event_handler);

    /*Set the today*/
    lv_calendar_date_t today;
    today.year = 2020;
    today.month = 2;
    today.day = 18;

    lv_calendar_set_today_date(calendar, &today);
    lv_calendar_set_showed_date(calendar, &today);

    /*Highlight some days*/
    static lv_calendar_date_t highlight_days[3];
    highlight_days[0].year = 2020;
    highlight_days[0].month = 2;
    highlight_days[0].day = 6;

    highlight_days[1].year = 2020;
    highlight_days[1].month = 2;
    highlight_days[1].day = 15;

    highlight_days[2].year = 2020;
    highlight_days[2].month = 2;
    highlight_days[2].day = 26;

    lv_calendar_set_highlighted_dates(calendar, &highlight_days,3);
}
  • call the lv_ex_calendar_1 function in main,compile and run this exmple.

 

 

 

 

 

关注
打赏
1658017818
查看更多评论
立即登录/注册

微信扫码登录

0.0377s