在 tizen native 中使用网格布局时无法在两个屏幕之间导航
Unable to navigate between the two screens while using grid layout in tizen native
在 Tizen 本机中使用网格布局时无法在两个屏幕之间导航。我单击 SCREEN1 上的按钮 1,这将打开具有 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);
这似乎是由小部件之间不必要的父子组合引起的问题。
elm_object_content_set(ad->navi, ad->grid);
naviframe widget本身没有放置网格的容器区域,
但由于上述 API 调用,网格已添加到 naviframe 的子对象中。
之后使用不同的网格对象调用相同的 API。
elm_object_content_set(nf, 网格);
发生这种情况时,导航框架会减去旧的子对象并构造一个新对象作为子对象。
被拖放的子对象成为一个孤立的对象,不会出现在屏幕上。
无需为 naviframe 调用 content_set。
naviframe的item变成一个view,每个view有一个容器区域
https://docs.tizen.org/application/native/guides/ui/efl/container-naviframe/
查看上面的指南,您可以了解 naviframe 如何处理项目。
无论如何解决你的问题是删除
"elm_object_content_set(nf, 网格);"
在 Tizen 本机中使用网格布局时无法在两个屏幕之间导航。我单击 SCREEN1 上的按钮 1,这将打开具有 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);
这似乎是由小部件之间不必要的父子组合引起的问题。
elm_object_content_set(ad->navi, ad->grid);
naviframe widget本身没有放置网格的容器区域, 但由于上述 API 调用,网格已添加到 naviframe 的子对象中。
之后使用不同的网格对象调用相同的 API。
elm_object_content_set(nf, 网格);
发生这种情况时,导航框架会减去旧的子对象并构造一个新对象作为子对象。 被拖放的子对象成为一个孤立的对象,不会出现在屏幕上。
无需为 naviframe 调用 content_set。 naviframe的item变成一个view,每个view有一个容器区域
https://docs.tizen.org/application/native/guides/ui/efl/container-naviframe/
查看上面的指南,您可以了解 naviframe 如何处理项目。
无论如何解决你的问题是删除 "elm_object_content_set(nf, 网格);"