(obj, new_x, new_y); //同时设置X、Y轴坐标 lv_obj_set_x(obj, new_x); //设置X轴坐标: lv_obj_set_y(obj, new_y); //设置Y轴坐标: /*** 设置对齐 ***/ //设置对齐(需要设置的对齐对象、对齐方式、偏移X、偏移Y) lv_obj_set_align(obj, LV_ALIGN_...,x,y); //设置对齐(需要...
obj.align(lvgl.ALIGN.type,x,y) obj.set_align(lvgl.ALIGN.type) 如果设置居中,有快捷接口obj.center() LVGL支持的对齐方式见下图: 例如,以下代码会将对象从其父对象的中心移动 10(x),20(y) 像素: importlvglaslv obj=lv.obj(lv.scr_act())obj.set_align(lv.ALIGN.CENTER);obj.set_pos(10,20);/...
lv_obj_t* parent = lv_obj_create(lv_scr_act());/*Create a parent object on the current screen*/ lv_obj_set_size(parent,100,80);/*Set the size of the parent*/ lv_obj_t* obj1 = lv_obj_create(parent);/*Create an object on the previously created parent object*/ lv_obj_set_...
void lv_user_gui_init(void) { lv_obj_t *switch1; switch1 = lv_switch_create(lv_scr_act()); lv_obj_set_size(switch1, 100, 50); lv_obj_set_align(switch1, LV_ALIGN_CENTER); }
void lv_demo(void) { lv_obj_t * obj = lv_obj_create(lv_scr_act()); lv_obj_set_style_bg_color(obj, lv_palette_main(LV_PALETTE_RED), 0); lv_obj_set_style_radius(obj, LV_RADIUS_CIRCLE, 0); lv_obj_align(obj, LV_ALIGN_LEFT_MID, 10, 0); ...
1.LV_EVENT_GESTURE事件的回调函数 2.较为完整的代码 3.工程源码 今天看了一下lvgl的EVENT枚举,有一个事件 LV_EVENT_GESTURE是响应手势滑屏的,就把电子相册的按键改为手势操作。 参考文章: 1.作者:weixin_46964996,文章: LVGL 的 LV_EVENT_GESTURE
选择lv_conf.h文件,在223行和230行,通过define 0/1 选择打开和关闭CPU,FPS,used memory 800,480即为窗口的尺寸 lv_obj_t* obj = lv_obj_create(lv_scr_act()); lv_obj_set_size(obj, LV_PCT(20), LV_PCT(10)); lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0); 创建第一个lvgl程序。 接下来...
/*Set the resolution of the display*/ disp_drv.hor_res = LV_HOR_RES_MAX; disp_drv.ver_res = LV_VER_RES_MAX; /*Used to copy the buffer's content to the display*/ disp_drv.flush_cb = disp_flush; /*Set a display buffer*/ ...
lv_obj_set_event_cb(btn1, event_handler); lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, -40); label = lv_label_create(btn1, NULL); lv_label_set_text(label, "Button"); lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), NULL); lv_obj_set_event_cb(btn2, event_handler);...
lv_obj_t *title = lv_label_create(new_screen); //创建一个标签lv_label_set_text(title, "这是一行内容\n这里是另一行"); lv_obj_set_style_text_align(title, LV_TEXT_ALIGN_CENTER, 0); //这个是标签内文本的居中,标签本身在界面上没有居中,而内容文本是居中的 ...