Reputation: 355
Is there a way to scale a button to it's text or align the text left? I have created a static method that allows me to set a generic theme for my buttons. I know you can use LayoutOptions.Start to make the button go to the left of the page.
public static void DefaultButtonTheme(Button button)
{
//previous code
.
.
button.HorizontalOptions = LayoutOptions.Start;
}
However, for text smaller than a certain amount of letters it is center of the button.
See image below.
Upvotes: 3
Views: 357
Reputation: 3607
I have investigated a bit this behaviour and I have found that this error appears on Android but not on UWP. I have also tried to use MinimumWidthRequest="0"
without result.
So as Anto Maniscalco said you should create a custom control and then overwrite the Android render using android:minHeight="0dp"
as you can see in the following link. It seems that Google decided by default to a minimum size for this control.
I hope this can help you.
Upvotes: 1