当前位置:网站首页>Click the input box to pop up the keyboard layout and move up
Click the input box to pop up the keyboard layout and move up
2022-04-23 18:42:00 【Xiao Xiaofeng】
- Keyboard pop-up monitoring ,
lineTaskbottom = (AutoLinearLayout) findViewById(R.id.line_taskbottom);
lineparams = new LinearLayout.LayoutParams(AutoLinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
editAdded.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
// When the keyboard pops up and hides, it will Call this method .
@Override
public void onGlobalLayout() {
Rect r = new Rect();
// Get the visual part of the current interface
this.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
// Get the height of the screen
int screenHeight = this.getWindow().getDecorView().getRootView().getHeight();
// Here is used to get the height of the keyboard , When the keyboard doesn't pop up This height is 0 When the keyboard pops up, it is a positive number
int heightDifference = screenHeight - r.bottom;
Log.d("Keyboard Size", "Size: " + heightDifference);
if (heightDifference > 0) {
lineparams.setMargins(0, heightDifference-120, 0, 0);
lineTaskbottom.setLayoutParams(lineparams);
} else {
lineparams.setMargins(0, 10, 0, 0);
lineTaskbottom.setLayoutParams(lineparams);
}
}
});
版权声明
本文为[Xiao Xiaofeng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210604091467.html
边栏推荐
- How can programmers quickly develop high-quality code?
- CISSP certified daily knowledge points (April 13, 2022)
- 机器学习理论之(8):模型集成 Ensemble Learning
- Seata处理分布式事务
- ESP32 LVGL8. 1 - input devices (input devices 18)
- Daily CISSP certification common mistakes (April 18, 2022)
- Ionic 从创建到打包指令集顺序
- If condition judgment in shell language
- Use bitnami / PostgreSQL repmgr image to quickly set up PostgreSQL ha
- Summary of actual business optimization scheme - main directory - continuous update
猜你喜欢

解决:cnpm : 无法加载文件 ...\cnpm.ps1,因为在此系统上禁止运行脚本

Query the logistics update quantity according to the express order number

机器学习实战 -朴素贝叶斯

WiFi ap6212 driver transplantation and debugging analysis technical notes

Résolution: cnpm: impossible de charger le fichier... Cnpm. PS1 parce que l'exécution de scripts est désactivée sur ce système

Druid SQL和Security在美团点评的实践

MVVM model

Halo 开源项目学习(七):缓存机制

Esp32 (UART ecoh) - serial port echo worm learning (2)

使用晨曦记账本,分析某个时间段每个账户收支结余
随机推荐
CISSP certified daily knowledge points (April 14, 2022)
Daily CISSP certification common mistakes (April 14, 2022)
ctfshow-web361(SSTI)
机器学习理论之(7):核函数 Kernels —— 一种帮助 SVM 实现非线性化决策边界的方式
[mathematical modeling] - analytic hierarchy process (AHP)
玻璃体中的硫酸软骨素
STM32: LCD显示
SQL中函数 decode()与 replace()的用法
QT tablewidget insert qcombobox drop-down box
Advanced transfer learning
Esp32 (UART 485 communication) - 485 communication of serial port (3)
CANopen STM32 transplantation
Daily network security certification test questions (April 18, 2022)
Seata handles distributed transactions
Use bitnami / PostgreSQL repmgr image to quickly set up PostgreSQL ha
In shell programming, the shell file with relative path is referenced
Esp32 (UART ecoh) - serial port echo worm learning (2)
Nacos作为服务配置中心实战
ESP32 LVGL8. 1 - anim animation (anim 16)
ESP32 LVGL8. 1 - textarea text area (textarea 26)