Try running lv_obj_move_background(img); by default the image is appended to the end of the message box and it gets positioned by the message box automatically.
Hi,there are some new problems in V7.11,when i create a img on the top of msg_box,i want use lv_obj_align(imge, msgbox, LV_ALIGN_IN_TOP_MID, 0, 40) , to set the img’s position,but it dosen’t work.
another one is i called lv_obj_set_size(msgbox,x,y) to set the msg_box’s size,it dosen’t work too.i found the height is drived by text lenth only.
Hi @juneofive
I might be able to help with the last thing you mentioned. I ran into the same “problem” and I believe these lines of code “fixes” it so you can modify height and width by yourself.
lv_cont_set_fit2 (MsgBox, LV_FIT_NONE, LV_FIT_NONE); //Modify the preset layout options and fits
lv_cont_set_layout (Msg, LV_LAYOUT_OFF);
I haven’t tested them independently, but I hope it still works
That might also solve your first problem
thanks very much,i copy your code after create msg_box, that it could set size,but all items’ postion of the msg box is on the top left. lv_obj_align(btnmx, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -10);could set postion,but i can’t find how to ge the label ,so it was still on top left
Yeah thats probably because the layout is working like “normal”, so i believe you just have to align the objects with lv_obj_align() and you should have complete control.