一、菜单页面,背景色不动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ui_MenuPage_bottom = lv_obj_create(NULL);
lv_obj_set_width(ui_MenuPage_bottom, 240);
lv_obj_set_height(ui_MenuPage_bottom,280);

bg_image = lv_img_create(ui_MenuPage_bottom);
lv_img_set_src(bg_image,&bg_2);
lv_obj_set_style_bg_opa(bg_image, LV_OPA_70, 0);

ui_MenuPage_top = lv_obj_create(ui_MenuPage_bottom);
lv_obj_set_align(ui_MenuPage_top, LV_ALIGN_TOP_MID);
lv_obj_add_flag(ui_MenuPage_top, LV_OBJ_FLAG_SCROLLABLE); // 设置为可滚动的对象
lv_obj_set_scroll_dir(ui_MenuPage_top, LV_DIR_VER);
lv_obj_set_style_bg_opa(ui_MenuPage_top, 0, 0);
lv_obj_set_width(ui_MenuPage_top, 240);
lv_obj_set_height(ui_MenuPage_top, 280);

二、右滑切换界面

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void ui_event_AboutPage(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
lv_obj_t * target = lv_event_get_target(e);//获取触发该事件的目标对象(即哪个控件触发了事件)

if(event_code == LV_EVENT_GESTURE) //检测手势
{
if(lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT)//右滑
{
user_Stack_Pop(&ScrRenewStack); //出栈
ui_MenuPage_screen_init(); //初始化目标页面
lv_scr_load_anim(ui_MenuPage_bottom,LV_SCR_LOAD_ANIM_MOVE_RIGHT,100,0,true);
user_Stack_Push(&ScrRenewStack,(long long int)&ui_MenuPage_bottom);//将目标页面压栈
}
}
}