I am facing a problem with android 5.0 and above. Whenever I align any view to parent bottom, Content is getting hidden behind the soft navigation button.
A
Here is the solution.
Most of the layouts get solved by adding these properties in value-21 style.xml
- true
- true
- true
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;
}