This action will force synchronization from 韦东山/lv_chinese_ime, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
lv_chinese_ime is a custom component written on the basis of lv_keyboard, it is no different from lv_keyboard, but the function of supporting Chinese input method (Pinyin) is added.
English | 中文 |
lv_chinese_ime
is a custom component written on the basis of lv_keyboard (the creation interface is: lv_chinese_ime_create(lv_obj_t *parent));
), it is no different from lv_keyboard, but the function of supporting Chinese input method (Pinyin) is added.
So we call it: Support Chinese input method LVGL keyboard (lv_keyboard) widget enhancement plugin.
Normally, as long as lvgl can run in an environment lv_chinese_ime
can also run! There are two main influencing factors: the size of the font file used and the size of the thesaurus used.
lv_chinese_ime
is very simple to use, and the subsequent custom expansion functions are also very convenient, so stay tuned for more functions.
https://github.com/100askTeam/lv_chinese_ime.git
lv_chinese_ime
directory should be next to the lvgl
directory in your project.
Similarly to lv_conf.h
there is a configuration file for the examples too. It is called lv_chinese_ime_conf.h
.lv_chinese_ime/lv_chinese_ime_conf_template.h
next to lv_chinese_ime
directorylv_chinese_ime_conf.h
#if 0
to #if 1
to enable the file's content/*declare font*/
LV_FONT_DECLARE(lv_font_source_han_sans_bold_14);
static void ta_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * ta = lv_event_get_target(e);
lv_obj_t * kb = lv_event_get_user_data(e);
if(code == LV_EVENT_FOCUSED) {
if(lv_indev_get_type(lv_indev_get_act()) != LV_INDEV_TYPE_KEYPAD) {
lv_keyboard_set_textarea(kb, ta);
lv_obj_set_style_max_height(kb, LV_HOR_RES * 2 / 3, 0);
lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_scroll_to_view_recursive(ta, LV_ANIM_OFF);
}
}
else if(code == LV_EVENT_READY || code == LV_EVENT_CANCEL) {
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_clear_state(ta, LV_STATE_FOCUSED);
lv_indev_reset(NULL, ta); /*To forget the last clicked object to make it focusable again*/
}
}
void your_test_function(void)
{
lv_obj_t * kb = lv_chinese_ime_create(lv_scr_act());
lv_chinese_ime_set_text_font(&lv_font_source_han_sans_bold_14, 0); // set font
//lv_chinese_ime_set_dict(your_dict); // Use a custom thesaurus. If it is not set, the built-in thesaurus will be used
/* ta1 */
lv_obj_t * ta1 = lv_textarea_create(lv_scr_act());
lv_obj_set_style_text_font(ta1, &lv_font_source_han_sans_bold_14, 0); // set font
lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 10, 10);
lv_keyboard_set_textarea(kb, ta1);
lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb);
/* ta2 */
lv_obj_t * ta2 = lv_textarea_create(lv_scr_act());
lv_obj_set_style_text_font(ta2, &lv_font_source_han_sans_bold_14, 0); // set font
lv_obj_align_to(ta2, ta1,LV_ALIGN_OUT_RIGHT_MID, 10, 0);
lv_obj_add_event_cb(ta2, ta_event_cb, LV_EVENT_ALL, kb);
}
lv_chinese_ime
can exist in a project at the same time.lv_chinese_ime
is not needed, please use lv_chinese_ime_del
to delete it.lv_chinese_ime
normally, you can recreate the usage through the [above](# Usage) usage example..This is an open project and contribution is very welcome! Contact us: smilezyb@163.com
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。