App:Library:LVGL:Readme:Examples
提供: robot-jp wiki
https://github.com/lvgl/lvgl#examples
Examples
1lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button to the current screen*/
2lv_obj_set_pos(btn, 10, 10); /*Set its position*/
3lv_obj_set_size(btn, 100, 50); /*Set its size*/
4lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/
5
6lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/
7lv_label_set_text(label, "Button"); /*Set the labels text*/
8lv_obj_center(label); /*Align the label to the center*/
9...
10
11void btn_event_cb(lv_event_t * e)
12{
13 printf("Clicked\n");
14}
15
16
17