已开启
软键盘弹出遮盖输入框问题修复; update repository URL from gitee.com to gitcode.com #1
软键盘弹出遮盖输入框问题修复; update repository URL from gitee.com to gitcode.com #1
已开启
zhouyixing创建于 1月29日
共 2 个文件变更+4-3
@@ -1,10 +1,10 @@
1-{1+{
2 "name": "@ohos_samples/keyboardlibrary",2 "name": "@ohos_samples/keyboardlibrary",
3 "version": "1.0.0",3 "version": "1.0.0",
4 "description": "This example shows the effect of a soft keyboard popping up on the page layout when the input box is at the top and bottom of the screen, respectively",4 "description": "This example shows the effect of a soft keyboard popping up on the page layout when the input box is at the top and bottom of the screen, respectively",
5 "main": "Index.ets",5 "main": "Index.ets",
6 "author": "@ohos_samples",6 "author": "@ohos_samples",
7 "license": "Apache-2.0",7 "license": "Apache-2.0",
8- "repository": "https://gitee.com/harmonyos_samples/keyboard/tree/br_release_hmos/",8+ "repository": "https://gitcode.com/HarmonyOS_Samples/keyboard/tree/br_release_hmos/",
9 "dependencies": {}9 "dependencies": {}
10}10}
@@ -35,7 +35,7 @@ export struct ContactPage {
35 };35 };
36 36 
37 aboutToAppear(): void {37 aboutToAppear(): void {
38- this.getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.RESIZE);38+ this.getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.OFFSET);
39 try {39 try {
40 WindowUtil.getWindowClass().on('keyboardHeightChange', this.changeCallback);40 WindowUtil.getWindowClass().on('keyboardHeightChange', this.changeCallback);
41 } catch (error) {41 } catch (error) {
@@ -188,6 +188,7 @@ export struct ContactPage {
188 .justifyContent(FlexAlign.SpaceBetween)188 .justifyContent(FlexAlign.SpaceBetween)
189 .width(CommonConstants.FULL_PERCENT)189 .width(CommonConstants.FULL_PERCENT)
190 .height(56)190 .height(56)
191+ .margin({ bottom: this.keyboardHeight > 0 ? this.keyboardHeight * 0.02: 0 })
191 }192 }
192 .backgroundColor($r('sys.color.background_secondary'))193 .backgroundColor($r('sys.color.background_secondary'))
193 .width(CommonConstants.FULL_PERCENT)194 .width(CommonConstants.FULL_PERCENT)