How to Reduce the Inner Padding of Xamarin.Forms Text Input Layout?
The space inside the Xamarin.Forms SfTextInputLayout can be customized using the InputViewPadding property as shown in the following code snippet.
[XAML]
<inputLayout:SfTextInputLayout ContainerType="Outlined" InputViewPadding="5"> <Entry Text="InputViewPadding 5" /> </inputLayout:SfTextInputLayout>
Output
To obtain the same space reduction for having different input views in SfTextInputLayout as follows.
Set the appropriate value for both the InputViewPadding and height of input view as follows
| iOS and UWP | Android |
InputViewPadding | 11 for left and right and 6 for top and bottom. | 11 for left and right and 0 for top and bottom. |
Height request of input view | 24 | 36 (Input view height + top padding + bottom padding). |
[XAML]
<Grid> <inputLayout:SfTextInputLayout ContainerType="Outlined" Hint="SfComboBox" InputViewPadding="{OnPlatform Android='11,0,11,0', iOS='11,6,11,6', UWP='11,6,11,6'}"> <comboBox:SfComboBox HeightRequest="{OnPlatform Android=36, iOS=24, UWP=24}"> . . . </comboBox:SfComboBox> </inputLayout:SfTextInputLayout> <inputLayout:SfTextInputLayout Grid.Column="1" ContainerType="Outlined" Hint="Entry" InputViewPadding="{OnPlatform Android='11,0,11,0', iOS='11,6,11,6', UWP='11,6,11,6'}"> <Entry HeightRequest="{OnPlatform Android=36, iOS=24, UWP=24}" Text="Entry" /> </inputLayout:SfTextInputLayout> </Grid>
See Also
Available container customization in Xamarin.Forms SfTextInputLayout
How to align leading and trailing views in Xamarin.Forms SfTextInputLayout
Color customization in Xamarin.Forms SfTextInputLayout