Code Monkey home page Code Monkey logo

Comments (4)

getActivity avatar getActivity commented on July 4, 2024

你好,这个问题正在修复

from androidproject.

OrangeHao avatar OrangeHao commented on July 4, 2024

这个问题超级蛋疼的,跟主题、布局等都有关系,我最近就弄过这个问题,最后还是采用了监听键盘显示,然后动态设置导航栏高度的方式来处理。当然我们那个更蛋疼,我们那个输入框是在导航栏上面挨在一起,输入法还要把输入框顶起来。

from androidproject.

getActivity avatar getActivity commented on July 4, 2024

这个原因已经排查到,父布局为LinearLayout,因为 ViewPager 使用了权重的问题,软键盘在弹出的时候会把布局进行收缩,ViewPager 的高度缩小了,所以 BottomNavigationView 会显示在ViewPager 下面,解决方法是在 ViewPager 初始化高度后手动进行设置 ViewPager 高度并将权重设置为0

from androidproject.

LittleStart-007 avatar LittleStart-007 commented on July 4, 2024

按照轮子哥的说法, 在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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.