应用内容进去的android L时导航栏后面 [英] application content goes behind the navigation bar in android L

查看:171
本文介绍了应用内容进去的android L时导航栏后面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如你可以看到我的知道了按钮导航bar.Not能够解决它的背后!我曾尝试

As you can see my "Got It" button is behind the navigation bar.Not able to fix it!!! I have tried

<item name="android:fitsSystemWindows">true</item>  

除了设置它的布局文件。

As well as setting it in layout file.

我的价值-21的主题是:

my theme in value-21 is :

 <style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowFullscreen">false</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:fitsSystemWindows">true</item>
    </style>

其不变的情况下在整个应用程序的所有屏幕。

Its the same case with all the screens throughout the application.

请帮助。

推荐答案

下面是解决方案。

大部分的布局得到通过价值21 style.xml添加这些特性解决了

Most of the layouts get solved by adding these properties in value-21 style.xml

<item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowTranslucentNavigation">true</item>
        <item name="android:fitsSystemWindows">true</item>

别人,我算过导航栏的HIGHT并增加保证金我的看法。

for others, I have calculated the hight of navigation bar and add margin to my view .

public static int getSoftButtonsBarSizePort(Activity activity) {
    // getRealMetrics is only available with API 17 and +
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        DisplayMetrics metrics = new DisplayMetrics();
        activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
        int usableHeight = metrics.heightPixels;
        activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
        int realHeight = metrics.heightPixels;
        if (realHeight > usableHeight)
            return realHeight - usableHeight;
        else
            return 0;
    }
    return 0;
}

注意:通过使用上述解决方案的一切工作,但我也是在PopupWindow我app.The布局使用PopupWindow在android系统L.搞的一团糟查找问题和解决方案<一个href=\"http://stackoverflow.com/questions/28340878/popup-window-is-not-properly-shown-in-android-l\">here

Note: By using the above solutions everything work but I was also using PopupWindow in my app.The layout of the PopupWindow get messed up in android L. Look for the issue and the solution here

这篇关于应用内容进去的android L时导航栏后面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆