How to set roller-option's align when setting fixed width?

Description

When I change the roller’s width by

lv_roller_set_fix_width(roller, 100);

and set the roller-option’s align by

lv_roller_set_align(roller,LV_LABEL_ALIGN_CENTER);

however the result is not seem to be align center. It is alway align left.
How to align the roller’s option when setting fixed width?

Thank you.

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

  • ESP32 board
  • LittleVGL 6.0.2

Code to reproduce

void create_roller(){

  lv_obj_t* roller;
  const char* roller_options = "1\n2\n3\n4\n5\n6\n7\n8\n9\n10";

  roller = lv_roller_create(lv_scr_act(), NULL);
  lv_roller_set_visible_row_count(roller,4);
  lv_roller_set_options(roller, roller_options, LV_ROLLER_MODE_INIFINITE);
  lv_roller_set_fix_width(roller, 100);
  lv_roller_set_align(roller,LV_LABEL_ALIGN_CENTER);
  lv_obj_align(roller, NULL, LV_ALIGN_CENTER,0,0);  
}

Screenshot and/or video

PHOTO_20190817_062652

I’ve just pushed a fix for it yesterday. Does it work now with the latest master?

2 Likes