0
即時嘗試在本機tizen中製作窗體屏幕。問題將小部件添加到水平箱式容器
我尋找這樣用方框的例子,但我無法找到他們。如果有人能夠幫助那會很好。
感謝。
這是我的代碼
static void
create_base_gui(appdata_s *ad)
{
// Create the window
ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
elm_win_conformant_set(ad->win, EINA_TRUE);
// Advertise which rotations are supported by the application; the
// device_orientation callback is used to do the actual rotation when
// the system detects the device's orientation has changed
if (elm_win_wm_rotation_supported_get(ad->win)) {
int rots[4] = { 0, 90, 180, 270 };
elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
}
// Add a callback on the "delete,request" event; it is emitted when
// the system closes the window
evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
// Alternatively, elm_win_autodel_set() can be used to close
// the window (not the application) automatically
// with the Back button, for example
// elm_win_autodel_set(ad->win, EINA_TRUE);
// Create the conformant
ad->conform = elm_conformant_add(ad->win);
// Set the conformant use as much horizontal and vertical space as
// possible, that is, expand in both directions
evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
// Set the conformant as the resize object for the window:
// the window and the conformant grow together
// in proportion to each other
elm_win_resize_object_add(ad->win, ad->conform);
// Create the naviframe
ad->naviframe = elm_naviframe_add(ad->conform);
elm_object_content_set(ad->conform, ad->naviframe);
// Show the box
evas_object_show(ad->conform);
// Show the conformant since all widgets are hidden by default
evas_object_show(ad->conform);
// Create the box
Evas_Object *box = elm_box_add(ad->naviframe);
// Set the box vertical
elm_box_horizontal_set(box, EINA_FALSE);
// The box expands when its contents need more space
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
// The box fills the available space
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
// Add the box in the naviframe container
elm_naviframe_item_push(ad->naviframe, "Hello World", NULL, NULL, box, NULL);
// Show the box
evas_object_show(box);
Evas_Object *box_one = elm_box_add(box);
elm_box_horizontal_set(box_one, EINA_TRUE);
evas_object_size_hint_weight_set(box_one, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
// Create the label
Evas_Object *label = elm_label_add(box_one);
// The label expands when its contents need more space
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
// The box fills the available space on the horizontal axis and is
// centered on the vertical axis (placed at 0.5 vertically, that is, in the
// middle)
evas_object_size_hint_align_set(label, 0.5, EVAS_HINT_FILL);
// Set the text for the label and set formatting through the HTML tags:
// - "Hello World!" centered on the first line
// - skip a line
// - Add a longer text that does not fit on a single line but wraps at
// the word boundaries
elm_object_text_set(label,
"<align=center>Hello World!</align><br>"
"<br>"
"<wrap = word>Clicking on the button below closes the application.</wrap>");
// Add the label at the end of the box
elm_box_pack_end(box_one, label);
// Show the label
evas_object_show(label);
// Create the button
Evas_Object *button = elm_button_add(box_one);
// The box expands when its contents need more space
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
// The button fills the available space on the horizontal axis and is
// placed at the bottom of the vertical axis (1 is the end of the axis,
// the coordinates start at (0, 0) on the top-left corner
evas_object_size_hint_align_set(button, 0.5, EVAS_HINT_FILL);
// Set the text for the button
elm_object_text_set(button, "Close!");
// Add a callback on the button for the "clicked" event; implementation of
// the callback is below
//evas_object_smart_callback_add(button, "clicked", clicked_cb, NULL);
// Add the widget at the end of the box; since the axis starts in the top left
// corner and the box is vertical, the end of the box is below the label
//elm_box_pack_end(box_one, button);
// Show the button
evas_object_show(button);
/* Show window after base gui is set up */
evas_object_show(ad->win);
}
在回答部分解決了您的問題嗎? –