relativelayout中的Textview和button在android oreo和pie中不可见,而在其他android版本中则完全可见。
if (mPromocodeCheckBox != null) {
mPromocodeCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (inputMethodManager == null)
inputMethodManager = (InputMethodManager) ALTCommonUtils.currentActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
if (mPromocodeLayout != null) {
if (isChecked) {
mPromocodeLayout.setVisibility(View.VISIBLE);
if (inputMethodManager != null && mPromocodeEditText != null) {
mPromocodeEditText.requestFocus();
inputMethodManager.showSoftInput(mPromocodeEditText, InputMethodManager.SHOW_IMPLICIT);
}
if (mPromocodeApplyButton != null)
mPromocodeApplyButton.setVisibility(View.VISIBLE);
if (mPromocodeEditText != null)
mPromocodeEditText.setEnabled(true);
} else {
mPromocodeLayout.setVisibility(View.GONE);
HandleViewsUtils.TextView_SetText(mPromocodeMsg, "");
if (inputMethodManager != null && mPromocodeEditText != null) {
HandleViewsUtils.EditText_SetText(mPromocodeEditText, "");
inputMethodManager.hideSoftInputFromWindow(mPromocodeEditText.getApplicationWindowToken(), 0);
}
}
}
}
});
}
Your xml screenshots were painful to read but, I just realized you're using fill_parent instead of match_parent. FILL_PARENT is deprecated in API 8 afterwards; Google Developer Documentation Source. Why you should use Match Parent.
Maybe it's time you moved towards the more recently introduced methods, design patterns and libraries. Start using Constraint Layout instead of Relative Layout. Benefits of Constraint Layout and its introduction in Android Studio 2.2 onwards. Stop using Relative Layouts and use them only when very necessary. Google I/O Talk of 2018 on Layouts, Link. You don't know when Google will decide to deprecate it and then you'd have projects that will stop working.
Another thing to keep in mind is the new Support Library AndroidX, to which you should start migrating your older projects. AndroidX will be the new singular support library for future and all that weird number based support libraries will be discontinued.
The last most important thing is you should start developing for Android API 28+ which will be enforced by Google from this year onwards; Google Developers Youtube Video. So, start migrating to current APIs and support library.
Hope this helps.
Addendum Make sure of Android Studio's alerts on your codebase regarding deprecation. More links here;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句