如何在原生 Tizen 应用程序中添加编辑文本? [英] How to add edit text in native Tizen app?

查看:49
本文介绍了如何在原生 Tizen 应用程序中添加编辑文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I try to understand the GUI creation in native Tizen app. Now I can add label and button. But I cannot find any solution how to add text edit (android TextEdit).

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

The button I add by below code:

   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 函数,但没有结果.

so I try to search elm_edit_text_add function but with no result.

推荐答案

这是单行代码Entry(TextEdit 等效):

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);

有关更多类型的条目,请查看 tizen SDK 提供的示例.

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

这篇关于如何在原生 Tizen 应用程序中添加编辑文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆