本文介绍了底部软导航栏与我的ListView重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Nexus 5(Android 5)上运行了我的应用程序,但是遇到了底部的导航栏与ListView的最后一项重叠的问题.我试图将fitsSystemWindows添加到我的样式和ListView中,但这没用.
I ran my app on a Nexus 5 (Android 5) but I encountered the problem that the soft NavigationBar at the bottom overlaps the last item of my ListView. I've tried to add fitsSystemWindows to my style and the ListView but that didn't work.
我的布局的XML:
The XML of my layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@color/sf4l"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@color/sf4l" />
</LinearLayout>
推荐答案
将其添加到values-v21目录中的themes.xml中:
Add this to your themes.xml in a values-v21 dir:
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
示例(我将AppCompat用于操作栏)
Example (I'm using AppCompat for actionbars):
<style name="Theme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="homeAsUpIndicator">@drawable/new_indicator</item>
<item name="android:homeAsUpIndicator">@drawable/new_indicator</item>
<item name="actionModeBackground">@android:color/black</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
</style>
这篇关于底部软导航栏与我的ListView重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!