I want to have a small button. The height of the button is 30. On some plattforms (Android, UWP) the text inside the button is cut off. That's because there is a padding between the text and the outside border.
One option is to make the button bigger, but there is enough space for the text. Is there an option for setting the inside padding?
Maybe you can play with the
FontSize
in order to fit the buttonHeightRequest
, unless that you need to create a custom renderer to set the padding.On Android, you can do this with styling.
Resources/values-v21/styles.xml
AndroidManifest.xml
Set custom theme as application theme.
It's setting the left and right margin to
0dp
. The default style has a padding.This is working on Android >= 5. If you want to support lower android versions, you have to add multiple style folders and use other base themes like
Theme.Holo
orTheme.AppCompat
.Or you go for the Renderer:
One option is to use a Label instead of a Button, and use a TapGestureRecognizer instead of Click events. The Label gives you more control over the layout of the text than a Button, but you don't get the advantage of it being translated into the native button control on each platform.