Description
how to set height of each option in a ddlist?
What MCU/Processor/Board and compiler are you using?
What do you want to achieve?
as the picture I uploaded, I want to set each option’s height of a ddlist same to the buttom matrix’s height, how to set the style?
What have you tried so far?
I try to set the the padding attributes of LV_DDLIST_STYLE_BG and LV_DDLIST_STYLE_SEL, but it doesn’t work.
Code to reproduce
The code block(s) should be formatted like:
static void chart_create(lv_obj_t * parent)
{
static const char* btnm_map[] = {"CH A", "CH B", "CH C", ""};
lv_obj_t* btnm = lv_btnm_create(parent, NULL);
lv_btnm_set_map(btnm, btnm_map);
lv_obj_set_size(btnm, 600, 60);
lv_obj_align(btnm, NULL, LV_ALIGN_CENTER, 0, 0);
/* ddlist */
static lv_style_t style_ddlist_bg;
lv_style_copy(&style_ddlist_bg, &lv_style_pretty);
style_ddlist_bg.body.main_color = LV_COLOR_WHITE;
style_ddlist_bg.body.grad_color = LV_COLOR_WHITE;
static lv_style_t style_ddlist_sel;
lv_style_copy(&style_ddlist_sel, &lv_style_plain_color);
style_ddlist_sel.body.main_color = LV_COLOR_BLUE;
style_ddlist_sel.body.grad_color = LV_COLOR_BLUE;
style_ddlist_sel.text.color = LV_COLOR_BLACK;
lv_obj_t* ddlist = lv_ddlist_create(parent, NULL);
lv_ddlist_set_options(ddlist, "CH D\n""CH E\n""CH F\n""CH G");
lv_ddlist_set_draw_arrow(ddlist, true);
lv_ddlist_set_fix_width(ddlist, 200);
lv_ddlist_set_fix_height(ddlist, 180);
lv_ddlist_set_style(ddlist, LV_DDLIST_STYLE_BG, &style_ddlist_bg);
lv_ddlist_set_style(ddlist, LV_DDLIST_STYLE_SEL, &style_ddlist_sel);
lv_obj_align(ddlist, btnm, LV_ALIGN_OUT_RIGHT_TOP, 0, 0);
}