如图 我觉得tab 1 2 3 三个按钮太大了 想改它们的高度 如何改
lv_obj_t * obj = lv_tabview_create(scr, NULL);
lv_obj_set_size(obj, 197, 231);
lv_obj_t * t1 = lv_tabview_add_tab(obj, "Tab 1");
lv_obj_t * t2 = lv_tabview_add_tab(obj, "Tab 2");
//lv_obj_set_size(t1, 20,20);
//lv_obj_set_event_cb(obj, general_event_handler);
lv_obj_t * label = lv_label_create(t1, NULL);
lv_label_set_text(label, "This the first tab");
label = lv_label_create(t2, NULL);
lv_label_set_text(label, "Second tab");
按道理应该是lv_obj_set_size(t1, 20,20); 但是没有用
离线
麻烦问一下,有没有littelvGL的学习资料,官方的手册看了,英文没看懂。
离线
我也碰到了这个问题找了好久:
C参考:
1、https://github.com/lvgl/lvgl/issues/628
2、https://forum.lvgl.io/t/how-to-set-tab-buttons-smaller/2425
static lv_style_t style_tv_btn_rel;
lv_style_copy(&style_tv_btn_rel, &lv_style_btn_rel);
style_tv_btn_rel.text.font = &lv_font_dejavu_10;
/*The vertical padding of the released button is applied to all buttons*/
style_tv_btn_rel.body.padding.ver = 5;
lv_obj_t * tv = lv_tabview_create(lv_scr_act(), NULL);
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_REL, &style_tv_btn_rel);
lv_tabview_add_tab(tv, "First");
lv_tabview_add_tab(tv, "Second");
micropython参考C:
self.styles = lv.style_t()
lv.style_copy(self.styles,lv.style_btn_rel)
self.styles.text.font = lv.font_roboto_16
self.styles.body.padding.left = 0
self.styles.body.padding.right = 0
self.styles.body.padding.top = 0
self.styles.body.padding.bottom = 0
self.tabview = lv.tabview(self)
#self.tabview.set_btns_hidden(True)
self.tabview.set_style(self.tabview.STYLE.BTN_REL, self.styles);
#self.tabview.set_pos(5, 10);
self.tabview.align(self.cont, lv.ALIGN.OUT_BOTTOM_MID, 0, 0)
self.decode = Decode_Simple(self.app, self.tabview.add_tab('decode'))
self.Pcompile = Pcompile_Simple(self.app, self.tabview.add_tab('Pcompile'))
micropython运行
离线