主页面
代码
static void stm32ui_main(void){
static lv_style_t bt_style;
lv_style_init(&bt_style);
//创建主页面
main_contanier=lv_obj_create(lv_scr_act());
lv_obj_set_size(main_contanier,480,320);
lv_obj_set_style_radius(main_contanier,0,0);
//主标题
static lv_style_t font_style;
lv_style_init(&font_style);
lv_obj_t *main_label=lv_label_create(main_contanier);
lv_label_set_text(main_label,"Campus Express Car System");
lv_obj_align(main_label,LV_ALIGN_TOP_MID,0,30);
lv_style_set_text_font(&font_style,&lv_font_montserrat_22);
lv_obj_add_style(main_label,&font_style,0);
//提醒标题
lv_obj_t * tip_label = lv_label_create(main_contanier);
lv_label_set_long_mode(tip_label, LV_LABEL_LONG_SCROLL_CIRCULAR); /*Circular scroll*/
lv_obj_set_width(tip_label, 150);
lv_label_set_text(tip_label, "Please select send or receive. ");
lv_obj_align(tip_label, LV_ALIGN_TOP_MID, 0, 70);
//发件按钮
bt_send=lv_btn_create(main_contanier);
lv_obj_t *bt_send_label=lv_label_create(bt_send);
lv_obj_align(bt_send,LV_ALIGN_CENTER,-100,10);
lv_obj_set_style_bg_color(bt_send,lv_color_hex(0x06A2FB),0);
lv_label_set_text(bt_send_label,"SEND");
lv_obj_center(bt_send_label);
lv_obj_add_event_cb(bt_send,stm32ui_but_event_hander,LV_EVENT_CLICKED,NULL);//触发按键
//收件按钮
bt_res=lv_btn_create(main_contanier);
lv_obj_t *bt_res_label=lv_label_create(bt_res);
lv_obj_align(bt_res,LV_ALIGN_CENTER,100,10);
lv_obj_set_style_bg_color(bt_res,lv_color_hex(0x17C7B5),0);
lv_label_set_text(bt_res_label,"REC");
lv_obj_center(bt_res_label);
lv_obj_add_event_cb(bt_res,stm32ui_but_event_hander,LV_EVENT_CLICKED,NULL);//触发按键
//统一按键样式
lv_style_set_size(&bt_style,100);
lv_style_set_text_font(&bt_style,&lv_font_montserrat_22);
lv_obj_add_style(bt_send,&bt_style,0);
lv_obj_add_style(bt_res,&bt_style,0);
}
SEND页面
代码
static void stm32ui_send(void){
static lv_style_t bt_style;
lv_style_init(&bt_style);
//创建二维码页面
send_contanier=lv_obj_create(lv_scr_act());
lv_obj_set_size(send_contanier,480,320);
lv_obj_set_style_radius(send_contanier,0,0);
//标题
static lv_style_t font_style;
lv_style_init(&font_style);
lv_obj_t *main_label=lv_label_create(send_contanier);
lv_label_set_text(main_label,