Skip to content

Commit

Permalink
Convert dp to px when setting ImageButton.CornerRadius (#4820)
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Swift authored Feb 25, 2022
1 parent 0b3c392 commit c9a45aa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Core/src/Platform/Android/ImageButtonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ public static void UpdateStrokeThickness(this ShapeableImageView nativeButton, I

public static void UpdateCornerRadius(this ShapeableImageView nativeButton, IButtonStroke buttonStroke)
{
var radius = nativeButton.Context.ToPixels(buttonStroke.CornerRadius);
nativeButton.ShapeAppearanceModel =
nativeButton.ShapeAppearanceModel
.ToBuilder()
.SetTopLeftCorner(CornerFamily.Rounded, buttonStroke.CornerRadius)
.SetTopRightCorner(CornerFamily.Rounded, buttonStroke.CornerRadius)
.SetBottomLeftCorner(CornerFamily.Rounded, buttonStroke.CornerRadius)
.SetBottomRightCorner(CornerFamily.Rounded, buttonStroke.CornerRadius)
.SetTopLeftCorner(CornerFamily.Rounded, radius)
.SetTopRightCorner(CornerFamily.Rounded, radius)
.SetBottomLeftCorner(CornerFamily.Rounded, radius)
.SetBottomRightCorner(CornerFamily.Rounded, radius)
.Build();
}
}
Expand Down

0 comments on commit c9a45aa

Please sign in to comment.