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.
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>
Add this to your themes.xml in a values-v21 dir:
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
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>
It's because height of your listView is equal full screen height but action bar pushes layout few pixel lower what causes layout overlap by navigation buttons.
This is also happening if you have full screen fragment container under action bar.
Fix for this is to mesure height of screen and of action bar, and then set height of your parent view to it's difference. Example:
@Override
public void onWindowFocusChanged (boolean hasFocus) {
LinearLayout lMain = (LinearLayout) findViewById(R.id.lMain);
lMain.getLayoutParams().height = lMain.getHeight() - getNavigationBarHeight();
}
I tried the accepted answer in this post and like many it didn't work for me.
However the following worker for me.
<item name="android:windowTranslucentNavigation">false</item>
I placed in styles-21.xml
What is does is make the soft navigation bar have a solid background and somehow now components are rendered correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With