问题描述
正如你所看到的,我的知道了"按钮在导航栏后面.无法修复!!!我试过了
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.
我在 value-21 中的主题是:
my theme in value-21 is :
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android: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.
请帮忙.
推荐答案
这是解决方案.
通过在 values-v21 style.xml 中添加这些属性来解决大多数布局
Most of the layouts get solved by adding these properties in values-v21 style.xml
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:fitsSystemWindows">true</item>
对于其他人,我已经计算了导航栏的高度并为我的视图添加了边距.
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.PopupWindow 的布局在 android L 中搞砸了.查找问题和解决方案 这里
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中的导航栏后面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!