I have this layout in Edje:
group {
name: "mylayout";
min: 200 200;
parts {
rect { "elm.bg";
scale: 0;
desc { "default";
visible: 1;
fixed: 1 1;
color: 255 0 0 255;
min: 200 200;
}
}
text { "elm.title";
scale: 0;
desc { "default";
text {
text: "Title";
size: 32;
}
}
}
}
}
I want to put 2 of this layout into a box, but I want all of them to "full-size", i.e I want a scrollable box.
Now if I put these layouts into a box, the box resizes them to fit all into one screen.
If I just add one to box:
But if I add two:
I add them to the box with this code:
Evas_Object* page = elm_layout_add(box);
elm_layout_file_set(page, "file.edj", "mylayout");
evas_object_size_hint_align_set(page, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(page, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(page);
elm_box_pack_end(box, page);
How can I force the box to just contain it's elements with their original size?
OS: Tizen 4.0.
https://www.enlightenment.org/develop/legacy/program_guide/edje/basic_concepts
fixed parameter means this part size is fixed, so regardless of what global size is, the part will show as it's own size.
so if you put fixed parameter, the min size of this part will not effect object size. I think you have to remove fixed parameter firstly.
now we have to talk about size hint align and weight.
hint align means where this content object have to be aligned in given area. you can easily think like 0 is top/left 0.5 is middle, 1.0 is bottom/right. but the predefined value FILL(-1) means fill the content object in given area.
hint align means how much weight this object have in the parent area. so if there are two objects in the box and one is weight 4, and one is 6, first one can only have 0.4 area of box and second one can have 0.6 area.
please see more details in upon link.
Here is my test code.
group {
name: "mylayout";
parts {
rect { "outline";
desc { "default";
visible: 1;
color: 0 0 0 255;
min: 200 200;
}
}
rect { "elm.bg"
desc { "default";
visible: 1;
color: 255 0 0 255;
rel.to: "outline";
rel1.offset: 1 1;
rel2.offset: -2 -2;
}
}
text { "elm.title";
scale: 0;
desc { "default";
text {
text: "Title";
size: 32;
}
}
}
}
}
Evas_Object *win, *bx;
char buf[PATH_MAX];
win = elm_win_util_standard_add("box-vert", "Box Vert");
elm_win_autodel_set(win, EINA_TRUE);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bx);
evas_object_show(bx);
Evas_Object* ly = elm_layout_add(bx);
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
elm_layout_file_set(ly, buf, "mylayout");
evas_object_size_hint_align_set(ly, 0.5, 0.5);
evas_object_size_hint_weight_set(ly, 1, 1);
evas_object_show(ly);
elm_box_pack_end(bx, ly);
Evas_Object* ly2 = elm_layout_add(bx);
elm_layout_file_set(ly2, buf, "mylayout");
evas_object_size_hint_align_set(ly2, 0.5, 0.5);
evas_object_size_hint_weight_set(ly2, 1, 1);
evas_object_show(ly2);
elm_box_pack_end(bx, ly2);
evas_object_show(win);
evas_object_resize(win, 360, 360);
If you have more question, please reply here! :)