Tizen 4: Why is a box container not able to hold another layout?

一笑奈何 提交于 2020-12-15 00:05:32

问题


I create a box container on Tizen 4.0:

Evas_Object* box = elm_box_add(naviframe);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(box);
elm_object_content_set(naviframe, box);

Then I want to add a layout from edje into the box:

Evas_Object* page = elm_layout_add(box);
elm_layout_file_set(page, "layout.edj", "groupname_in_layout");
evas_object_show(page);
elm_box_pack_end(box, page); 

Then I push the box into the screen:

elm_naviframe_item_push(naviframe, NULL, NULL, NULL, box, "empty");

But the layout is not displaying on the emulator.

However, if I just simply add the layout to the naviframe (and not to the box), it's displayed:

//elm_box_pack_end(box, page); 
elm_naviframe_item_push(naviframe, NULL, NULL, NULL, page, "empty");

It is also displayed if I programmatically create a label and put it into the box:

Evas_Object* text = elm_label_add(box);
elm_object_text_set(text, "<align=center>Hello Tizen</align>");
evas_object_show(text);
elm_box_pack_end(box, text);

elm_naviframe_item_push(naviframe, NULL, NULL, NULL, box, "empty");

Why on Earth denies a Box layout to contain the only reasonable layout in Tizen (Layout)?? Especially after reading their "docs":

You can add any Evas object to the box.

Based on my knowledge, "any" means any: so a Layout is also part of the group named "any".


回答1:


Actually box can contain just you have to set the align and weight of the layout, no matter what the layout definition contains.

Great help from here: How to add edit text in native Tizen app?, thanks @IsaacCisneros.

So I had only add

evas_object_size_hint_align_set(page, EVAS_HINT_FILL, 0.0);
evas_object_size_hint_weight_set(page, EVAS_HINT_EXPAND, 0.0);

And now it works.



来源:https://stackoverflow.com/questions/65235823/tizen-4-why-is-a-box-container-not-able-to-hold-another-layout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!