Switch is not displayed in the list

Adding the switch control to the list item is not displayed, as follows:
a = lv_list_add_btn(list1, &network_icon, “setting”);
s = lv_switch_create(a,NULL);
lv_obj_align(s,NULL, LV_ALIGN_CENTER, 0, 0);

Try this:


    lv_obj_t * a = lv_list_add_btn(list1, LV_SYMBOL_OK, "Some text");
    lv_obj_t * s = lv_switch_create(a,NULL);
    lv_obj_add_protect(s, LV_PROTECT_POS);
    lv_obj_align(s,NULL, LV_ALIGN_CENTER, 0, 0);

The lsit items has row layout by default and the switch is placed out of the button on the right. lv_obj_add_protect(s, LV_PROTECT_POS); you can take the switch out of the layout.