I am using the legacy ShowcaseView for Android. I notice that the Android 5 emulator puts the OK button underneath the softnavigation bar, whereas Android <= KITKAT did not have this behaviour.
See the OK button in the lower right corner here: http://imgur.com/SZtIcHr
I already tried android:fitsSystemWindows="true" but no success. Here is the relevant code in the ShowcaseView.java that I found:
mEndButton = (Button) LayoutInflater.from(context).inflate(R.layout.showcase_button, null);
(Warning: Avoid passing null as the view root (needed to resolve layout parameters on the inflated layout's root element)) [..]
if (!mOptions.noButton && mEndButton.getParent() == null) {
RelativeLayout.LayoutParams lps = (LayoutParams) generateDefaultLayoutParams();
lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
if (getConfigOptions().showcaseId==3)
lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
else
lps.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
int margin = ((Number) (metricScale * 12)).intValue();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) // TODO: LOLLIPOP workaround
lps.setMargins(margin, margin, margin, margin*5);
else
lps.setMargins(margin, margin, margin, margin);
lps.height = LayoutParams.WRAP_CONTENT;
lps.width = LayoutParams.WRAP_CONTENT;
mEndButton.setLayoutParams(lps);
mEndButton.setText(buttonText != null ? buttonText : getResources().getString(R.string.positive));
if (!hasCustomClickListener) mEndButton.setOnClickListener(this);
addView(mEndButton);
I don't know how to change this or how Android 5 / material design has caused this behaviour. I would be happy for a hint! :)
The classic Navigation bar has the Recents, Home, and Back buttons at the bottom of your screen.
The Android navigation bar houses the device navigation controls: Back, Home, and Overview. It also displays a menu for apps written for Android 2.3 or earlier.
There are four navigational buttons that you can use to move throughout a menu: up, down, right, and left. Each button corresponds to the direction that you can move in a menu. For example, to move right in a menu, press the navigation button that is located on the right side.
For me works set manually the margin bottom without use the margin returned from the method to obtain int margin.
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
int margin = ((Number) (context.getResources().getDisplayMetrics().density * 12)).intValue();
layoutParams.setMargins(margin, margin, margin, 120);
Hope it works...
The problem has been fixed here...
I found very easy fix for this in one of pull requests
Add:
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
to your style/theme in values-v21/styles.xml.
Works well for me, checked on a real device - Nexus 5.
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