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] ImageButton.CornerRadius operates in DP #4819

Closed
J-Swift opened this issue Feb 21, 2022 · 2 comments
Closed

[android] ImageButton.CornerRadius operates in DP #4819

J-Swift opened this issue Feb 21, 2022 · 2 comments
Assignees
Labels
area-controls-button Button, ImageButton platform/android 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@J-Swift
Copy link
Contributor

J-Swift commented Feb 21, 2022

Description

When you set ImageButton.CornerRadius on android it doesn't convert to px, so it appears wrong.

With this code

var btn = new ImageButton()
{
    WidthRequest = 48,
    HeightRequest = 48,
    Source = ...,
};
btn.CornerRadius = (int)(btn.HeightRequest / 2.0);

This is the result on iOS
Screen Shot 2022-02-21 at 6 32 59 PM

This is the result on Android with a 420 dpi screen
Screen Shot 2022-02-21 at 6 33 01 PM

Steps to Reproduce

var btn = new ImageButton()
{
    WidthRequest = 48,
    HeightRequest = 48,
    Source = ...,
};
btn.CornerRadius = (int)(btn.HeightRequest / 2.0);

Version with bug

Preview 13 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

All android with screen dpi != 160

Did you find any workaround?

Convert dp to px manually when setting CornerRadius

Relevant log output

No response

@J-Swift J-Swift added the t/bug Something isn't working label Feb 21, 2022
@jsuarezruiz jsuarezruiz added the area-controls-button Button, ImageButton label Feb 22, 2022
@jsuarezruiz jsuarezruiz self-assigned this Feb 22, 2022
@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Feb 22, 2022
@shimingsg
Copy link

verified repro with VS 17.2.0 Preview 2.0 [32228.339.main]
4819.zip
image

@shimingsg shimingsg added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Mar 1, 2022
@jsuarezruiz
Copy link
Contributor

Fixed by #4820

@ghost ghost locked as resolved and limited conversation to collaborators Apr 6, 2022
@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 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants