Comments (4)
你好,这个问题正在修复
from androidproject.
这个问题超级蛋疼的,跟主题、布局等都有关系,我最近就弄过这个问题,最后还是采用了监听键盘显示,然后动态设置导航栏高度的方式来处理。当然我们那个更蛋疼,我们那个输入框是在导航栏上面挨在一起,输入法还要把输入框顶起来。
from androidproject.
这个原因已经排查到,父布局为LinearLayout,因为 ViewPager 使用了权重的问题,软键盘在弹出的时候会把布局进行收缩,ViewPager 的高度缩小了,所以 BottomNavigationView 会显示在ViewPager 下面,解决方法是在 ViewPager 初始化高度后手动进行设置 ViewPager 高度并将权重设置为0
from androidproject.
按照轮子哥的说法, 在HomeActivity 的initView 加上下面这句就行了.
ViewTreeObserver vto = mViewPager.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@OverRide
public void onGlobalLayout() {
//防止键盘遮挡布局
mViewPager.getViewTreeObserver().removeOnGlobalLayoutListener(this);
int pagerHeight = mViewPager.getHeight();
LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) mViewPager.getLayoutParams(); // 取控件mGrid当前的布局参数
linearParams.height = pagerHeight;// 当控件的高强制设成测量好的高
linearParams.weight = 0;//
mViewPager.setLayoutParams(linearParams); // 使设置好的布局参数应用到控件
}
});
from androidproject.
Related Issues (20)
- androidx.appcompat:appcompat升级 HOT 3
- 关于目前App比较常态化得问题 HOT 1
- 布局中有androidx.core.widget.NestedScrollView组件会阻断BaseActivity中点击空白收起键盘的逻辑 HOT 2
- BaseActivity:startActivityForResult疑惑 HOT 2
- 日期dialog 设置当前日期为2018-12-31, 但页面上显示的是2018-12-30 HOT 3
- 项目缺少 com.hjq.demo.http.glide.GlideApp 文件 HOT 1
- Q群满了老哥 进不去啊 HOT 1
- 又出现了 不清楚是什么问题。 HOT 3
- 打开 AndroidProject APP,LeakCanary 检测启动页出现内存泄露 HOT 5
- gradle升到7+以后aop切面不适配了 HOT 2
- 关于使用TabAdapter配合ViewPager时,导航栏超出屏幕范围后滑动viewpager时导航栏item不显示 HOT 3
- AppActivity实现OnHttpListener意义是什么? HOT 1
- 查看大图模块中onItemClick position 返回值问题 HOT 3
- 建议增加一个下载网络图片到相册的功能 HOT 1
- Demo项目的BuildConfig.HOST_URL在不同环境中始终不变 HOT 3
- 缺少GlideApp文件 HOT 1
- 首次编译提示Your build is currently configured to use Java 17.0.6 and Gradle 6.5 HOT 1
- 是否有更新Gradle8+,Java17,替换通过Aspectjx实现的AOP? HOT 5
- BrowserActivity内存泄漏,网页界面空白 HOT 1
- 现在的项目不存在问题,使用中台重构项目,两个lib依赖会冲突,为此特意新建项目写了个Demo,同时引用也不存在问题,使用中台,必现 HOT 2
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 androidproject.