Description
- Use different font files roller unable to set center align.
What MCU/Processor/Board and compiler are you using?
arm
What LVGL version are you using?
v7.5.0
What do you want to achieve?
Set roller center align.
What have you tried so far?
lv_roller_set_align, have no effect.
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*/
``` static lv_style_t style;
lv_style_init(&style);
lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_100);
lv_style_set_radius(&style, LV_STATE_DEFAULT, 0);
lv_style_set_border_width(&style, LV_STATE_DEFAULT, 0);
lv_style_set_text_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_style_set_text_line_space(&style, LV_STATE_DEFAULT, 46);
lv_style_set_text_font(&style, LV_STATE_DEFAULT, &Apeman_bd_26height);
//lv_style_set_text_font(&style, LV_STATE_DEFAULT, &SF_Pro_Text_Bold_23px);
lv_style_set_text_opa(&style, LV_STATE_DEFAULT, LV_OPA_20);
lv_obj_t *roller = lv_roller_create(lv_scr_act(), NULL);
lv_obj_add_style(roller, LV_ROLLER_PART_BG, &style);
lv_obj_add_style(roller, LV_ROLLER_PART_SELECTED, &style);
lv_roller_set_options(roller, "TEXT1\nTEXT2\nTEXT3", LV_ROLLER_MODE_NORMAL);
lv_roller_set_auto_fit(roller, false);
lv_roller_set_visible_row_count(roller, 4);
lv_obj_set_size(roller, 150, 200);
lv_obj_align(roller, NULL, LV_ALIGN_CENTER, 0, 0);