Skip to content
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

[Android] Fix issues rendering gradients and CornerRadius on Button #5971

Merged
merged 4 commits into from
Apr 26, 2022

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

Fix issues rendering gradients and corner radius on Android Button.

image

Issues Fixed

Fixes #5950
Fixes #5930

@jsuarezruiz jsuarezruiz added t/bug Something isn't working platform/android 🤖 area-controls-button Button, ImageButton labels Apr 11, 2022
if (background is SolidPaint)
platformView.UpdateBackground(background);
else
platformView.UpdateBorderDrawable(button);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this issue? Basically because we have implemented Handlers, in this specific case the Button in different phases and we have not detected this problem with tests. We initially implement the Background property using an AppCompatButton. Subsequently, by implementing properties related to the Border (BorderWidth, etc) we change the type of native control to use for a MaterialButton.

The MaterialButton requires BackgroundTintList to be set to null in order to render a custom background. If a custom background is set, a Drawable is used where the background is drawn and, if there is a border, use the Drawabable too. Otherwise, the BackgroundColor property and the StrokeWidth etc properties of the MaterialButton itself are used.

@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Apr 11, 2022
@Redth Redth merged commit a61092a into main Apr 26, 2022
@Redth Redth deleted the fix-5950 branch April 26, 2022 19:03
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-button Button, ImageButton platform/android 🤖 t/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mauipalooza] Button background doesn't render gradient [mauipalooza] CornerRadius not working on Button
3 participants