Scrollable page


I am trying out the scrollable page example on the documentation

If a child is created on the page it will be automatically moved to the scrollable container. If the scrollable container becomes larger then the background it can be scrolled by dragging (like the lists on smartphones).

Also on the interactive example on the website the page is scrollable. However, trying the same code on hardware the page is fixed(though the scroll bar is visible).

How to make the page scrollable?


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

ESP-32 nodeMCU-32s
ili9341 display

What LVGL version are you using?


What do you want to achieve?

displaying a page with a scroll bar

What have you tried so far?

Tried out other touchable element to make sure that the screen’s wiring is correct.

Code to reproduce

void lv_ex_page_1(void)
    /*Create a page*/
    lv_obj_t * page = lv_page_create(lv_scr_act(), NULL);
    lv_obj_set_size(page, 150, 200);
    lv_obj_align(page, NULL, LV_ALIGN_CENTER, 0, 0);

    /*Create a label on the page*/
    lv_obj_t * label = lv_label_create(page, NULL);
    lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK);            /*Automatically break long lines*/
    lv_obj_set_width(label, lv_page_get_width_fit(page));          /*Set the label width to max value to not show hor. scroll bars*/
    lv_label_set_text(label, "Lorem ipsum dolor sit amet, consectetur adipiscing elit,\n"
                             "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n"
                             "Ut enim ad minim veniam, quis nostrud exercitation ullamco\n"
                             "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure\n"
                             "dolor in reprehenderit in voluptate velit esse cillum dolore\n"
                             "eu fugiat nulla pariatur.\n"
                             "Excepteur sint occaecat cupidatat non proident, sunt in culpa\n"
                             "qui officia deserunt mollit anim id est laborum.");

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

setting the label as a glue object seems to work.
lv_page_glue_obj(label, true);

1 Like