How to self align an object with flexbox?


I want to align this object to the right.
The two objects are children of the container that has the flex layout.
I can’t align the second object (object highlighted in the image above) to the right.

Which version of LVGL you use ?

LVGL v8.1 (master)

As far as I understand you should use flex alignment. But I didn’t use v8, so maybe someone else can explain this.

If I use flexible alignment, I have to align all children of the container (lv_obj_set_style_flex_cross_place(cont, LV_FLEX_ALIGN_END, 0)) and I just want to align the second object to the left (LV_FLEX_ALIGN_END).

Align-self is not supported by LVGL at this moment.

As workaround I suggest this:

  1. Create a width=100% wrapper object for each text box
  2. Align these wrappers into a column with flex
  3. Set LV_ALIGN_TOP_LEFT/RIGHT on the text boxes.
1 Like