这个是我创建win的代码
想创建一个button 然后label 在button的右边但是不行
static lv_style_t win_style;
lv_style_copy(&win_style, &lv_style_transp);
lv_obj_t * win = lv_win_create(lv_disp_get_scr_act(NULL),NULL);
lv_obj_set_size(win, 200, LV_VER_RES / 2);
lv_obj_set_pos(win, pPoint->x, pPoint->y);
lv_obj_set_top(win, true);
lv_win_set_style(win, LV_WIN_STYLE_CONTENT, &win_style);
static lv_style_t win_head_style;
lv_style_copy(&win_head_style, &lv_style_pretty_color);
win_head_style.body.opa = 128;
win_head_style.text.font = &lv_font_chinese_24;
win_head_style.text.color =LV_COLOR_RED;
lv_win_set_style(win, LV_WIN_STYLE_HEADER, &win_head_style);
lv_obj_t * win_close_btn=lv_win_add_btn(win, LV_SYMBOL_CLOSE);
lv_obj_set_event_cb(win_close_btn, lv_win_close_event_cb);
lv_win_set_title(win, "快捷菜单");
lv_win_set_layout(win,LV_LAYOUT_COL_L);
static lv_style_t label_style1;
lv_style_copy(&label_style1, &lv_style_plain_color);
label_style1.text.font = &lv_font_chinese_24;
lv_obj_t *btn1 = lv_btn_create(win, NULL);
lv_btn_set_toggle(btn1, true);
lv_obj_set_event_cb(btn1, my_event_cb);
lv_obj_align(btn1, win, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_t *btn1_label = lv_label_create(btn1, NULL);
lv_label_set_text(btn1_label, "主菜单");
lv_label_set_style(btn1_label,LV_LABEL_STYLE_MAIN,&label_style1);
lv_obj_align(btn1_label,btn1, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, 0);
出现的窗口button和label没有对齐
最近编辑记录 tango_zhu (2019-10-28 12:07:59)
离线
离线
离线