您尚未登录。

楼主 #1 2019-10-28 12:03:30

tango_zhu
会员
注册时间: 2018-04-12
已发帖子: 121
积分: 3

lvgl 对齐操作失效

这个是我创建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没有对齐
FluxBB bbcode 测试

最近编辑记录 tango_zhu (2019-10-28 12:07:59)

离线

楼主 #2 2019-10-28 12:04:36

tango_zhu
会员
注册时间: 2018-04-12
已发帖子: 121
积分: 3

离线

楼主 #3 2019-10-28 12:06:24

tango_zhu
会员
注册时间: 2018-04-12
已发帖子: 121
积分: 3

Re: lvgl 对齐操作失效

FluxBB bbcode 测试

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn