maui
maui copied to clipboard
ImageButton RippleEffect not working in some cases
Description
This PR (https://github.com/dotnet/maui/pull/22298) should fix the ripple effect on android. It works in almost every case but there are some cases which don't work.
Steps to Reproduce
Open repro app. The first three image buttons are not working.
Link to public reproduction project repository
No response
Version with bug
Nightly / CI build (Please specify exact version)
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Open similar issues:
- ImageButton Padding & Ripple effect stops working with .NET 8 (#18857), similarity score: 0.77
- CollectionView selecteditem background lost if collectionview (or parent) IsEnabled changed. (#20615), similarity score: 0.72
Closed similar issues:
- [regression/8.0.3] [Android] Button ripple effect not working (#18815), similarity score: 0.79
- [regression/8.0.0-preview.6.8686] Button Click Ripple Effect Not Working In Android (#17642), similarity score: 0.79
- Buttons missing ripple effect in windows? (#7492), similarity score: 0.72
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Can repro this issue at android platform on the latest 17.11.0 Preview 1.0(8.0.60-ci.net8.24273.1/8.0.40).
The standard buttons also have this behaviour. The problem could be the background color from the button or from the parent element. If the color is white, transparent or not set no ripple is not working.
Looking at this some more, I see the following with each of the buttons:
- no background => "use default OS background" - so for image buttons, the OS does not have a ripple
- transparent => this has a ripple, but it is not visible since the ripple is white and appears under the image
- white => this has a ripple but it is not visible since the ripple is white and appears under the image
- color => the white ripple is visible and under the image.
Since ImageButton has no ripple so it feels wrong, I will make sure it gets a ripple if no background is set.
Perhaps it makes sense -if possible- to set a colour for the ripple. If the ripple is always white and is sometimes not visible the user has not the android typical feedback.
For normal Button, there is a RippleColor property, but for the ImageButton, it is all fake as an image button is not a thing supported by Android and we are using a fancy image control.
But, changing the ripple color sounds like a feature request and we could see about adding that if people want it.
For normal Button, there is a RippleColor property
Interesting. I didn't know that. Is this accessable via platform specific code: On<Android>() or via handler?
Thank you
This is not really a xplat feature, so we don't have an api for it. But, if you want you can add your own mapper for Android. And maybe even your own attached property - or even an effect to not have to do anything.
PlatformView.RippleColor = color.ToPlatform();
That in an effect is all that is needed.