How to align two lables

Description


the number 1 seems smaller than other characters,

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

What LVGL version are you using?

8.2

What do you want to achieve?


just like this

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/
```c 
void uiTest(lv_obj_t *parent){

    lv_obj_t * cont = lv_obj_create(parent);

    lv_obj_set_size(cont,200,50);

    lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); //禁止滚动

    lv_obj_t * label1 = lv_label_create(cont);

    lv_obj_t * label2 = lv_label_create(cont);

    lv_obj_set_pos(label1,-14,-14);

    lv_obj_align_to(label2,label1,LV_ALIGN_OUT_BOTTOM_LEFT,0,0);

    lv_obj_center(cont);

    // lv_label_set_recolor(label1, true);  

    // lv_label_set_recolor(label2, true);  

    lv_label_set_text_fmt(label1,"AMP1:%f",3.3f);

    lv_label_set_text_fmt(label2,"AMP2:%f",2.3f);

}
## Screenshot and/or video
If possible, add screenshots and/or videos about the current state.

You can create “layered” layout.
image

  1. set cont as flex layout with ROW alignment.
  2. create on cont two object that will act as groups on.
  3. set group_1 width to LV_SIZE_CONTENT, height to LV_PCT(100)
  4. set group_2 height to LV_PCT(100) and any width.
  5. set group_2 flex_grow to 1
  6. set group_1 and group_2 flex layout to COLUMN
  7. now append “AMP” labels to group_1 and values labels to group_2

You probably want a monospaced font instead of Montserrat…