LVGL7 大幅度修改了编程接口, 以前LVGL6版本的主题接口已经不能继续用了
离线
添加定义:
static void button_event_cb(lv_obj_t * slider, lv_event_t e);
static lv_obj_t *button2, *button3;
添加两个按钮:
button2 = lv_btn_create(h, NULL);
lv_obj_set_event_cb(button2, button_event_cb);
lv_obj_t* label2 = lv_label_create(button2, NULL);
lv_label_set_text(label2, "红色主题");
button3 = lv_btn_create(h, NULL);
lv_obj_set_event_cb(button3, button_event_cb);
lv_obj_t* label3 = lv_label_create(button3, NULL);
lv_label_set_text(label3, "绿色主题");
添加按钮事件:
static void button_event_cb(lv_obj_t * button, lv_event_t e)
{
if (e == LV_EVENT_RELEASED)
{
if (button2 == button)
{
lv_theme_t * theme = LV_THEME_DEFAULT_INIT(LV_COLOR_RED,
LV_THEME_DEFAULT_COLOR_SECONDARY,
LV_THEME_DEFAULT_FLAG,
LV_THEME_DEFAULT_FONT_SMALL,
&myFont,
LV_THEME_DEFAULT_FONT_SUBTITLE,
LV_THEME_DEFAULT_FONT_TITLE);
lv_theme_set_act(theme);
}
else if (button3 == button)
{
lv_theme_t * theme = LV_THEME_DEFAULT_INIT(LV_COLOR_GREEN,
LV_THEME_DEFAULT_COLOR_SECONDARY,
LV_THEME_DEFAULT_FLAG,
LV_THEME_DEFAULT_FONT_SMALL,
&myFont,
LV_THEME_DEFAULT_FONT_SUBTITLE,
LV_THEME_DEFAULT_FONT_TITLE);
lv_theme_set_act(theme);
}
}
}
离线
离线
请教tabview的标题文字能修改中文吗
你用中文有什么问题吗?
离线