How do I Highlight the selected item of a lv_list in LVGL 8.1


I’m trying to show the selected state of an item in a lv_list.
I need the selected item to remain highlighted once clicked on.
This was possible in V7, but cannot get it to work in V8.

What LVGL version are you using?


What have you tried so far?

In V8 I tried:
lv_obj_add_state(list_btn[1], LV_STATE_FOCUSED);

In V7 this worked (resulted in the item showing as focused in the list):
lv_list_focus_btn(my_list, list_btn[1]);

Screenshot and/or video


I found that using lv_obj_add_state(list_btn[1], LV_STATE_FOCUSED | LV_STATE_PRESSED);
Will give the desired effect, only now I have to figure out how to release that state when another field is pressed. Perhaps there is an easier way?