【关键字】
自定义键盘 / 系统键盘
【问题描述】
搜索自定义键盘包含中文键盘, 切换到系统键盘。
使用相关API后,键盘已经切换到系统键盘了,但是系统键盘无法弹出, 需要再次点击 输入框,系统键盘才会弹出。
示例代码如下:
import CommonConstants from '../common/constants/CommonConstants';
import KeyEventListen from '../viewmodel/KeyEventListen';
import { NumberKeyboard } from '../view/NumberKeyboard';
import { EnglishKeyboard } from '../view/EnglishKeyboard';
@Entry
@Component
struct Index {
@State keyboardType: number = 0
@State text: string = ''
controller: TextInputController = new TextInputController()
build() {
Column() {
Button('Set caretPosition 1')
.onClick(() => {
this.controller.caretPosition(1)
})
TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller })
.placeholde