i'm developing native app samsung gear (tizen). have multi line label dynamically generated (can have 2 or 3 lines). how can center vertically?
use elementary box container. align childs in vertical middle.
here sample code. refer code box , 3 labels in app_create function.
#include <sstream> #include <app.h> #include <elementary.h> #include <efl_extension.h> static bool app_create(void *data) { evas_object *win = elm_win_util_standard_add("sample", "sample"); elm_win_autodel_set(win, eina_true); if (elm_win_wm_rotation_supported_get(win)) { int rots[4] = { 0, 90, 180, 270 }; elm_win_wm_rotation_available_rotations_set(win, (const int *)(&rots), 4); } auto back_cb = [](void *data, evas_object *obj, void *event_info) { elm_win_lower(static_cast<evas_object*>(data)); }; evas_object_smart_callback_add(win, "delete,request", [](void*, evas_object*, void*){ui_app_exit();}, null); eext_object_event_callback_add(win, eext_callback_back, back_cb, win); evas_object *conform = elm_conformant_add(win); elm_win_indicator_mode_set(win, elm_win_indicator_show); elm_win_indicator_opacity_set(win, elm_win_indicator_opaque); evas_object_size_hint_weight_set(conform, evas_hint_expand, evas_hint_expand); elm_win_resize_object_add(win, conform); evas_object_show(conform); evas_object *box = elm_box_add(conform); evas_object_show(box); elm_object_content_set(conform, box); evas_object *labels[3]; (int i=0; i<3; i++) { std::ostringstream ss; ss << "<align=center>line : " << << "</align>"; labels[i] = elm_label_add(box); elm_object_text_set(labels[i], ss.str().c_str()); evas_object_show(labels[i]); elm_box_pack_end(box, labels[i]); } evas_object_show(win); return true; } int main(int argc, char *argv[]) { ui_app_lifecycle_callback_s event_callback = { app_create, nullptr, nullptr, nullptr, nullptr }; return ui_app_main(argc, argv, &event_callback, nullptr); }
Comments
Post a Comment