Comments (5)
你好,请问你遇到这个问题的设备信息是什么。
另外你提到获取虚拟返回键的高度,具体是指哪部分源码
from panelswitchhelper.
设备名称:华为P9,型号VIE-AL10 EMUI版本8.0.0 安卓版本8.0.0 有虚拟返回键盘
采用头条的适配方案在聊天界面设置
@OverRide
public Resources getResources() {
return AdaptScreenUtils.adaptWidth(super.getResources(), 360);
}
就会出现底部的虚拟返回键会挡住部分输入框的布局。
经过定位分析发现是工具类DisplayUtil 131行 getNavigationBarHeight 获取的高度减少了一半,带有虚拟返回键的手机才会出现这个问题。
解决方案:修改DisplayUtil 154行的 getInternalDimensionSize这个方法
private fun getInternalDimensionSize(key: String): Int {
val res = Resources.getSystem()// 关键修改点
var result = 0
val resourceId = res.getIdentifier(key, Constants.DIMEN, Constants.ANDROID)
if (resourceId > 0) {
result = res.getDimensionPixelSize(resourceId)
}
return result
}
审查合理的话,希望可以更新下。我现在的修改是直接下载源码进行修改的。
from panelswitchhelper.
getInternalDimensionSize 用于获取当前页面导航栏的高度,通过Resources.getSystem() 获取的高度和实际高度会有差异,会导致测量高度不准确
from panelswitchhelper.
建议这样修改兼容性会更强一些:
fun getInternalDimensionSize(context: Context, key: String): Int {
val result = 0
try {
val resourceId = Resources.getSystem().getIdentifier(key, Constants.DIMEN, Constants.ANDROID)
if (resourceId > 0) {
val sizeOne = context.resources.getDimensionPixelSize(resourceId)
val sizeTwo = Resources.getSystem().getDimensionPixelSize(resourceId)
return if (sizeTwo >= sizeOne && !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q &&
key != Constants.STATUS_BAR_HEIGHT_RES_NAME)
) {
sizeTwo
} else {
val densityOne = context.resources.displayMetrics.density
val densityTwo = Resources.getSystem().displayMetrics.density
val f = sizeOne * densityTwo / densityOne
(if (f >= 0) f + 0.5f else f - 0.5f).toInt()
}
}
} catch (ignored: NotFoundException) {
return 0
}
return result
}
from panelswitchhelper.
from panelswitchhelper.
Related Issues (20)
- 在480*800分辨率,但屏幕特小的手机上
- PanelSwitchHelper同时存在于Activity和dialog时,导致Activity上的PanelSwitchHelper无法监听 HOT 3
- 打开键盘,退到桌面,再进来,点击输入框会导致面板无法关闭
- 自定义EditText 不弹出键盘 HOT 1
- 为什么你发的新版旧版就用不了了呢? HOT 1
- 列表item长按弹出popWindow
- 1.5.4版本依赖下载不下来,试了下1.5.3版本就可以正常下载 HOT 1
- ViewPger2+Fragment切换时,PanelSwitchLayout中布局不显示 HOT 3
- 弹出软键盘时崩溃 HOT 1
- bug,崩溃 HOT 3
- [兼容性缺陷]华为mate20Pro弹出键盘页面展示异常 HOT 2
- 点击表情面板时,EditText焦点丢失,光标不显示 HOT 2
- 仿抖音评论弹窗效果
- 其他方案 HOT 1
- 全屏视频播放的情景,输入框面板基于PopWindow实现,假如是点击外部的表情按钮唤起 面板,直接显示表情面板该怎样实现? HOT 1
- 使用 BaseDialogFragment 并设置高度后,底部输入框部分不展示,或者展示不全 HOT 3
- android 14 无法唤起相机拍照 HOT 1
- 输入框无法长按弹出系统的全选复制粘贴ContextMenu HOT 1
- 通过输入法快捷切换进行输入法的切换,搜狗输入法小米版本没有让布局弹起
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panelswitchhelper.