Bottom soft NavigationBar overlaps my ListView
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();
}
- you have to do this after layout is already drawn/rendered. In onCreate or onResume is too early. Doing so in onWindowFocusChanged() is maybe litle overkill but it works.
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.
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>