0

我尝试了解原生 Tizen 应用程序中的 GUI 创建。现在我可以添加标签和按钮。但我找不到任何解决方案如何添加文本编辑(android TextEdit)。

我通过以下代码添加的按钮:

   ad->button = elm_button_add(ad->box1);
   evas_object_smart_callback_add(ad->button, "clicked", btn_clicked_cb, ad);
   evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0.1);
   evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_object_text_set(ad->button, "Preform");
   evas_object_show(ad->button);
   elm_box_pack_end(ad->box1, ad->button);

所以我尝试搜索 elm_edit_text_add 函数但没有结果。

4

2 回答 2

0

This is the code for a single line Entry (TextEdit equivalent):

    Evas_Object *entry;
    Evas_Object *layout;
    Evas_Object *scroller;
    Evas_Object *box;
    Evas_Object *nf = data;

    scroller = elm_scroller_add(nf);

    box = elm_box_add(scroller);
    evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
    evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
    elm_object_content_set(scroller, box);

    layout = elm_layout_add(box);
    elm_layout_file_set(layout, ELM_DEMO_EDJ, "entry_layout");
    evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, 0.0);
    evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0.0);

    entry = elm_entry_add(layout);
    elm_entry_single_line_set(entry, EINA_TRUE);
    elm_entry_scrollable_set(entry, EINA_TRUE);
    eext_entry_selection_back_event_allow_set(entry, EINA_TRUE);
    evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_smart_callback_add(entry, "activated", entry_activated_cb, NULL);
    elm_object_part_content_set(layout, "entry_part", entry);

    elm_box_pack_end(box, layout);
    evas_object_show(layout);

For more types of entries look at the examples provided with the tizen SDK.

于 2015-01-16T11:45:59.373 回答
0

添加编辑文本和各种其他可用字段的另一种方法如下。

创建一个UI Builder - Navigation/UI Builder - Single View应用程序。

File -> New -> Project -> Tizen -> Tizen Native Project -> Template -> UI Builder - Navigation -> 输入项目名称并单击 Finish。

layout文件夹中,您将看到 layout.xml 文件。

在 layout.xml 的 Palette 中,通过在情节提要的 " Entry" 中Input UI Components拖放来添加 " " Design

于 2016-05-17T08:18:33.800 回答