-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Image on Button is not centered with text #3527
Comments
|
First thanks for your time, Forget about the PropertyChanged (my bad, I was expected ImageProperty not TextProperty in sample) The issue is about the image stick close to the border, depending of Button.ContentLayout.Position The image is not centered and it's caused by:
-> Here an implementation in Java of a Custom drawn Android button which aligns left drawable and its text to center. Regards, |
X:\git\forms\Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Bugzilla27417.cs |
Does anyone have a workaround? |
You could use the option of 'padding' on the button itself as a work around? |
Yep, that's what I've ended up with (I'm lucky to have a fixed width buttons in this project). Thanks |
So, I have fixed this for Material, and encapsulated all the logic for button layout into a single place: #4967 Right now, all that is needed to get the image in either place is a boolean flag. However, as this is a breaking change for the older renderers, we will probably not be able to change the behaviour. However, there are some things we can do:
|
I'm having this issue on Android but on iOS works fine. |
@mattleibow could you provide us with sample code of what we need to change in a custom renderer/android specific to fix this? A fix is absolutely necessary, otherwise the "Image" feature cannot be used. |
Hi! |
Any update? |
This is still not fixed for such a long period? |
I don't think this will be resolved yet. I worked around it with my custom button and touch effect. |
Probably we will not see any updates on Xamarin, since MAUI is released |
Ability to align icon with text is there but it is disabled by default. You can change it with custom renderer:
Note second ctor arg of ButtonLayoutManager. |
Description
The Image is not in the center on Button when displaying with a text.
Steps to Reproduce
Expected Behavior
The image have to stick the text on the center.
Actual Behavior
The Image is stick to the border depends of the selected position.
I was searching a way to make a correction on UpdateBitmap
But PropertyName "Image" never pass to UpdateBitmap
Basic Information
The text was updated successfully, but these errors were encountered: