【发布时间】:2021-02-08 14:20:24
【问题描述】:
在 Tizen 本机中使用网格布局时无法在两个屏幕之间导航。我单击 SCREEN1 上的 button1,它将打开具有 YES 和 NO 按钮的 SCREEN2。当我单击“否”按钮时,它应该返回到 SCREEN1 - 但现在发生的情况是当我单击“否”按钮时会显示黑屏。如果我单击“是”按钮,它会打开一个弹出屏幕,其中显示一条消息 5 秒钟,然后它应该返回到 SCREEN1,但现在它又返回到 SCREEN2。以下代码是使用的任何人都可以检查和帮助。谢谢
static void
screen1_button_clicked(void *data, Evas_Object *obj, void *event_info){
Evas_Object *nf = data;
Evas_Object *grid;
/* Grid Layout */
grid = elm_grid_add(nf);
evas_object_show(grid);
elm_object_content_set(nf, grid);
elm_naviframe_item_push(nf, "Screen 2", NULL, NULL, grid, NULL);
/* Decline Button */
no_button = elm_button_add(grid);
elm_object_style_set(no_button, "circle");
elm_grid_pack(grid, no_button, 5, 35, 50, 50);
evas_object_show(no_button);
evas_object_smart_callback_add(no_button, "clicked",no_button_clicked, nf);
/* Decline Button - Icon */
no_button_icon = elm_icon_add(no_button);
elm_image_file_set(no_button_icon,ICON_DIR"/no_button.png",NULL);
evas_object_size_hint_min_set(no_button_icon, 100, 100);
evas_object_size_hint_max_set(no_button_icon, 100, 100);
elm_object_part_content_set(no_button,"icon",no_button_icon);
evas_object_show(no_button_icon);
/* Confirm Button */
yes_button = elm_button_add(grid);
elm_object_style_set(yes_button, "circle");
elm_grid_pack(grid, yes_button, 45, 35, 50, 50);
evas_object_show(yes_button);
evas_object_smart_callback_add(yes_button, "clicked", yes_button_clicked, nf);
/* Confirm Button - Icon */
yes_button_icon = elm_icon_add(yes_button);
elm_image_file_set(yes_button_icon,ICON_DIR"/yes_button.png",NULL);
evas_object_size_hint_min_set(yes_button_icon, 100, 100);
evas_object_size_hint_max_set(yes_button_icon, 100, 100);
elm_object_part_content_set(yes_button,"icon",yes_button_icon);
evas_object_show(yes_button_icon);
}
static void
no_button_clicked(void *data, Evas_Object *obj, void *event_info){
Evas_Object *nf = data;
elm_naviframe_item_pop(nf);
}
/* Base Gui */
/* Naviframe */
ad->navi = elm_naviframe_add(ad->conform);
evas_object_show(ad->navi);
elm_object_content_set(ad->conform, ad->navi);
/* Grid Layout */
ad->grid = elm_grid_add(ad->navi);
elm_object_content_set(ad->navi, ad->grid);
evas_object_show(ad->grid);
ad->navi_item = elm_naviframe_item_push(ad->navi, "Screen 1", NULL,NULL, ad->grid, NULL);
/* Button */
screen1_button = elm_button_add(ad->grid);
elm_object_style_set(screen1_button, "circle");
elm_grid_pack(ad->grid, screen1_button, 15, 37, 35, 50);
evas_object_show(screen1_button);
screen1_button_icon = elm_icon_add(screen1_button);
elm_image_file_set(screen1_button_icon,ICON_DIR"/button1.png",NULL);
evas_object_size_hint_min_set(screen1_button_icon, 123, 123);
evas_object_size_hint_max_set(screen1_button_icon, 123, 123);
elm_object_part_content_set(screen1_button,"icon",screen1_button_icon);
evas_object_show(screen1_button_icon);
evas_object_smart_callback_add(screen1_button, "clicked",screen1_button_clicked, ad->navi);
【问题讨论】:
标签: c tizen tizen-wearable-sdk tizen-native-app