here is first page code
static void DispLogo()
{
/Darken the button when pressed/
static lv_style_t style;
lv_style_init(&style);
lv_style_set_image_recolor_opa(&style, LV_STATE_PRESSED, LV_OPA_30);
lv_style_set_image_recolor(&style, LV_STATE_PRESSED, LV_COLOR_BLACK);
lv_style_set_text_color(&style, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_clean(lv_scr_act());
lv_obj_t * scr = lv_obj_create(NULL, NULL);
lv_scr_load(scr);
/*Create imgbtn*/
lv_obj_t* paymentbtn = lv_imgbtn_create(scr, NULL);
lv_imgbtn_set_src(paymentbtn, LV_BTN_STATE_RELEASED, &lv_logo_payment);
lv_imgbtn_set_src(paymentbtn, LV_BTN_STATE_PRESSED, &lv_logo_payment);
lv_imgbtn_set_checkable(paymentbtn, true);
lv_obj_add_style(paymentbtn, LV_IMGBTN_PART_MAIN, &style);
lv_obj_align(paymentbtn, scr, LV_ALIGN_IN_TOP_LEFT,20, 30);
//lv_obj_set_auto_realign();
lv_obj_t* Networkbtn = lv_imgbtn_create(scr, NULL);
lv_imgbtn_set_src(Networkbtn, LV_BTN_STATE_RELEASED, &lv_logo_network);
lv_imgbtn_set_src(Networkbtn, LV_BTN_STATE_PRESSED, &lv_logo_network);
lv_imgbtn_set_checkable(Networkbtn, true);
lv_obj_add_style(Networkbtn, LV_IMGBTN_PART_MAIN, &style);
lv_obj_align(Networkbtn, scr, LV_ALIGN_IN_TOP_LEFT,120, 30);
lv_obj_t* Downloadbtn = lv_imgbtn_create(scr, NULL);
lv_imgbtn_set_src(Downloadbtn, LV_BTN_STATE_RELEASED, &lv_logo_Download);
lv_imgbtn_set_src(Downloadbtn, LV_BTN_STATE_PRESSED, &lv_logo_Download);
lv_imgbtn_set_checkable(Downloadbtn, true);
lv_obj_add_style(Downloadbtn, LV_IMGBTN_PART_MAIN, &style);
lv_obj_align(Downloadbtn, scr, LV_ALIGN_IN_TOP_LEFT, 220, 30);
lv_obj_t* Testbtn = lv_imgbtn_create(scr, NULL);
lv_imgbtn_set_src(Testbtn, LV_BTN_STATE_RELEASED, &lv_logo_Test);
lv_imgbtn_set_src(Testbtn, LV_BTN_STATE_PRESSED, &lv_logo_Test);
lv_imgbtn_set_checkable(Testbtn, true);
lv_obj_add_style(Testbtn, LV_IMGBTN_PART_MAIN, &style);
lv_obj_align(Testbtn,scr, LV_ALIGN_IN_TOP_LEFT,20,130);
lv_obj_t* Historybtn = lv_imgbtn_create(scr, NULL);
lv_imgbtn_set_src(Historybtn, LV_BTN_STATE_RELEASED, &lv_logo_History);
lv_imgbtn_set_src(Historybtn, LV_BTN_STATE_PRESSED, &lv_logo_History);
lv_imgbtn_set_checkable(Historybtn, true);
lv_obj_add_style(Historybtn, LV_IMGBTN_PART_MAIN, &style);
lv_obj_align(Historybtn,scr, LV_ALIGN_IN_TOP_LEFT, 120, 130);
lv_obj_t* Infobtn = lv_imgbtn_create(scr, NULL);
lv_imgbtn_set_src(Infobtn, LV_BTN_STATE_RELEASED, &lv_logo_Info);
lv_imgbtn_set_src(Infobtn, LV_BTN_STATE_PRESSED, &lv_logo_Info);
lv_imgbtn_set_checkable(Infobtn, true);
lv_obj_add_style(Infobtn, LV_IMGBTN_PART_MAIN, &style);
lv_obj_align(Infobtn, scr, LV_ALIGN_IN_TOP_LEFT, 220, 130);
}
here is second page code:
static void DispInput()
{
lv_obj_clean(lv_scr_act());
lv_obj_t * scr = lv_obj_create(NULL, NULL);
lv_scr_load(scr);
lv_obj_t* title = lv_label_create(scr, NULL);
lv_label_set_text(title, “PAYMENT”);
lv_obj_set_size(title, 320, 10);
lv_obj_align(title,scr, LV_ALIGN_IN_TOP_MID, 0,30);
lv_obj_set_style_local_bg_color(title, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_obj_set_style_local_bg_opa(title, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_obj_t* amt = lv_label_create(scr, NULL);
lv_label_set_text(amt, "AMOUNT:");
lv_obj_set_size(amt, 50, 10);
lv_obj_align(amt,scr, LV_ALIGN_IN_TOP_LEFT, 10, 50);
lv_obj_t* Cur = lv_label_create(scr, NULL);
lv_label_set_text(Cur, " $ ");
lv_obj_set_size(Cur, 50, 10);
lv_obj_align(Cur,scr, LV_ALIGN_IN_TOP_RIGHT, -20, 50);
lv_obj_t* input = lv_textarea_create(scr, NULL);
lv_obj_set_size(input, 320, 40);
lv_obj_align(input, scr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, -80);
lv_textarea_set_text(input, "0.01");
lv_textarea_set_text_align(input,LV_LABEL_ALIGN_RIGHT);
lv_obj_set_state(input, LV_STATE_DEFAULT);
//lv_obj_set_event_cb(input, Input_handler);
static lv_style_t style_btn;
lv_style_init(&style_btn);
lv_style_set_transition_time(&style_btn, LV_STATE_PRESSED, 400);
lv_style_set_transition_time(&style_btn, LV_STATE_DEFAULT, 0);
lv_style_set_transition_delay(&style_btn, LV_STATE_DEFAULT, 200);
lv_style_set_outline_width(&style_btn, LV_STATE_DEFAULT, 0);
lv_style_set_outline_width(&style_btn, LV_STATE_PRESSED, 20);
lv_style_set_outline_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_outline_opa(&style_btn, LV_STATE_FOCUSED, LV_OPA_COVER); /*Just to be sure, the theme might use it*/
lv_style_set_outline_opa(&style_btn, LV_STATE_PRESSED, LV_OPA_TRANSP);
lv_style_set_transition_prop_1(&style_btn, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
lv_style_set_transition_prop_2(&style_btn, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_WIDTH);
lv_obj_t* back = lv_btn_create(scr, NULL);
lv_obj_align(back, scr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_add_style(back, LV_BTN_PART_MAIN, &style_btn);
lv_obj_set_style_local_value_str(back, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Back");
//lv_obj_set_event_cb(back, Back_home_handle);
lv_obj_t* Trans_type = lv_btn_create(scr, NULL);
lv_obj_align(Trans_type,scr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
lv_obj_add_style(Trans_type, LV_BTN_PART_MAIN, &style_btn);
lv_obj_set_style_local_value_str(Trans_type, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Type");
//lv_obj_set_event_cb(back, Select_TransType_handle);
}
when i pressed confirm button on keyboad,will switch to page_2(DispInput),when i pressed Cancle Button on keyboad,will switch page_1(DispLogo)