Set the size of dropdown list

Description

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?

V7.7.2-dev

What do you want to achieve?

Make dropdownlist smaller

Code to reproduce

lv_obj_t * ddlist = lv_dropdown_create(lv_scr_act(), NULL);
    lv_dropdown_set_options(ddlist,
            "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);

https://docs.lvgl.io/v7/en/html/widgets/dropdown.html#_CPPv426lv_dropdown_set_max_heightP8lv_obj_t10lv_coord_t
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:

ApplicationFrameHost_DGCJPDFYdP

lv_obj_set_size(ddlist, x, y);

it works! thanks!

1 Like