Set the size of dropdown list


I would like to set the width of a dropdownlist smaller, how can I do it? I can’t find nothing in the documentation. Thanks in advance

What MCU/Processor/Board and compiler are you using?

Esp32 nodeMCU with Arduino IDE

What LVGL version are you using?


What do you want to achieve?

Make dropdownlist smaller

Code to reproduce

lv_obj_t * ddlist = lv_dropdown_create(lv_scr_act(), NULL);
            "WIFI 1\n"
            "WIFI 2\n"
            "WIFI 3\n"
            "WIFI 4\n");
    lv_dropdown_set_symbol(ddlist, false);
    lv_dropdown_set_text(ddlist, LV_SYMBOL_WIFI);
    lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
    lv_dropdown_set_show_selected(ddlist, false);
    lv_obj_set_event_cb(ddlist, dropDown_handler);
try this lv_dropdown_set_max_height( lv_obj_t * ddlist ,20 )

Sorry, I didn’t explain well, I need to make smaller the width of dorpdownlist element like this:


lv_obj_set_size(ddlist, x, y);

it works! thanks!

1 Like