Such issue. Set the ripple effect on the button. On all versions of Android works correctly: when I press the button, it is slightly illuminated, then when I release the button, there is a small ripple. On Android 9 works half: the button is highlighted, but when the button is released, there is no ripple. Has anyone come across this? How can I fix it?
I ran into this problem and it was due to me setting the background colour to white for the preferenceTheme
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="preferenceTheme">@style/SettingsTheme</item>
</style>
<style name="SettingsTheme" parent="PreferenceThemeOverlay">
<item name="android:background">@color/white</item>
</style>
To fix this, I removed the preferenceTheme and set the background colour as white in my preference fragment:
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.white));
}
Also update your preference code to the latest AndroidX way of doing things, eg in your prefs.xml use this:
<androidx.preference.PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.