赞
踩
一个自定义键盘
效果
完成简单的26键中英文输入
使用:
@Entry @Component struct IndexInput { @State text: string = '' inputController: TextInputController = new TextInputController() //自定义键盘关闭事件 hideClick(){ this.inputController.stopEditing() } //自定义键盘组件 @Builder shurufa(){ inputting({text: this.text,hideClick:()=>{this.hideClick()}}) } build() { Row() { TextArea({ text: this.text, controller: this.inputController }) .customKeyboard(this.shurufa(),{supportAvoidance:true})//supportAvoidance 是否避让 }.width('100%') .height('100%') .justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center) } }
一个简单的词库,模拟器上使用够了
因代码内包含词库,太大,所以以资源形式下载
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。