-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure ImageButton always has a background #22717
Conversation
The OS does not specify a background so we need to make sure there is a transparent background to get the ripple and border.
@@ -76,7 +77,9 @@ internal static void UpdateButtonStroke(this ShapeableImageView platformView, IB | |||
|
|||
internal static void UpdateButtonBackground(this ShapeableImageView platformView, IImageButton button) | |||
{ | |||
platformView.UpdateMauiRippleDrawableBackground(button, | |||
platformView.UpdateMauiRippleDrawableBackground( | |||
button.Background ?? new SolidPaint(Colors.Transparent), // transparent to force some background |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use the same default color applied to Button?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this ever was the case, so it may be a breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it always Transparent ? Should we grab the color from the theme here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me test OG net8 and see. I am sure I have always seen transparent because this is not a button, it is an image view. I will also test net7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested OG 8.0.3 and there is no background. Same with 7.0.101+4.
Do you have any before and after video of the effect? |
I added a video for the ripple, a bit hard to see as modern Androids have a very subtle ripple. But, I also opened an issue for a platform specific property: #22805 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might have just created this bug: #23119 |
Description of Change
The OS does not specify a background so we need to make sure there is a transparent background to get the ripple and border.
We can't really test ripple and we can't really test a null background vs a transparent background as they are supposed to look exactly the same.
The original issue was observing a lack of ripple on white, but this is because the ripple is white. In traditional buttons, there is a
RippleColor
property on the platform view. However, on image buttons, the control is just an image view so does not have any ripple effects - we are adding it. It will have to be a separate platform effect to add a ripple color property.See #22805
Issues Fixed
Fixes #22603
Before
before.webm
After
Now the top right button has a ripple
after.webm
DEMO CODE