问题如图:
在LVGL的dropdowng 列表的文字比较小不符合习惯
改变了样式只能改变被选中文字带大小
怎么调整大小嘞?
上代码
static void event_cb(lv_event_t * e)
{
lv_obj_t * obj = lv_event_get_target(e);
lv_obj_set_style_text_font(((lv_dropdown_t *)obj)->list, &lv_font_montserrat_20,0);
}
/**
* Create a menu from a drop-down list and show some drop-down list features and styling
*/
void lv_example_dropdown_3(void)
{
static lv_style_t EXIT_btn_style;
lv_style_init(&EXIT_btn_style);//初始化样式
lv_style_set_text_font(&EXIT_btn_style,&lv_font_montserrat_20); //设置字体样式
/*Create a drop down list*/
lv_obj_t * dropdown = lv_dropdown_create(lv_scr_act());
lv_dropdown_set_options(dropdown, "New project\n"
"New file\n"
"Save\n"
"Save as ...\n"
"Open project\n"
"Recent projects\n"
"Preferences\n"
"Exit");
/*Set a fixed text to display on the button of the drop-down list*/
//lv_dropdown_set_text(dropdown, "Menu");//
lv_obj_align(dropdown, LV_ALIGN_CENTER, 10, 10);
/*Use a custom image as down icon and flip it when the list is opened*/
// LV_IMG_DECLARE(img_caret_down)
//lv_dropdown_set_symbol(dropdown, &img_caret_down);
// lv_obj_set_style_transform_angle(dropdown, 1800, LV_PART_INDICATOR | LV_STATE_CHECKED);
/*In a menu we don't need to show the last clicked item*/
// lv_dropdown_set_selected_highlight(dropdown, false);
lv_obj_add_style(dropdown, &EXIT_btn_style, 0); //添加样式
lv_obj_add_event_cb(dropdown, event_cb, LV_EVENT_CLICKED, NULL);
}
演示效果如下: