1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(list): fix text style

fixes #5005
This commit is contained in:
Gabor Kiss-Vamosi 2023-12-13 15:36:24 +01:00
parent 779d2025b8
commit de2f7effd9
2 changed files with 7 additions and 2 deletions

View File

@ -36,11 +36,15 @@ const lv_obj_class_t lv_list_class = {
const lv_obj_class_t lv_list_button_class = {
.base_class = &lv_button_class,
.width_def = LV_PCT(100),
.height_def = LV_SIZE_CONTENT,
.name = "list-btn",
};
const lv_obj_class_t lv_list_text_class = {
.base_class = &lv_label_class,
.width_def = LV_PCT(100),
.height_def = LV_SIZE_CONTENT,
.name = "list-text",
};
@ -68,7 +72,9 @@ lv_obj_t * lv_list_create(lv_obj_t * parent)
lv_obj_t * lv_list_add_text(lv_obj_t * list, const char * txt)
{
LV_LOG_INFO("begin");
lv_obj_t * obj = lv_label_create(list);
lv_obj_t * obj = lv_obj_class_create_obj(&lv_list_text_class, list);
lv_obj_class_init_obj(obj);
lv_label_set_text(obj, txt);
return obj;
}
@ -78,7 +84,6 @@ lv_obj_t * lv_list_add_button(lv_obj_t * list, const void * icon, const char * t
LV_LOG_INFO("begin");
lv_obj_t * obj = lv_obj_class_create_obj(&lv_list_button_class, list);
lv_obj_class_init_obj(obj);
lv_obj_set_size(obj, LV_PCT(100), LV_SIZE_CONTENT);
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
#if LV_USE_IMG == 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB