我正在使用
legacy ShowcaseView for Android.我注意到Android 5模拟器将OK按钮放在softnavigation栏下面,而Android< = KITKAT没有这种行为. 请参见右下角的确定按钮:
http://imgur.com/SZtIcHr
我已经尝试过android:fitsSystemWindows =“true”但没有成功.以下是我发现的ShowcaseView.java中的相关代码:
- mEndButton = (Button) LayoutInflater.from(context).inflate(R.layout.showcase_button,null);
(警告:避免传递null作为视图根(需要解析膨胀布局的根元素上的布局参数))
[..]
- 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*5);
- else
- lps.setMargins(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);
我不知道如何改变这个或Android 5 /材料设计如何导致这种行为.我很乐意提示!