A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a Button with a fixed height, and I need to offset the position of the text upwards. Increasing the bottom padding does not work, because the bottom of the text is initially cropped due to the Button having a fixed height. How can I reposition the text in the Button?
Increasing the bottom padding does not work
I test follow button, it is working. Please set the value of bottom padding to the half the value of height.
<Button HeightRequest="150" Padding="0,0,0,80" FontSize="Large" Text="Phone2" BackgroundColor="Aqua" HorizontalOptions="Center" VerticalOptions="Center" />
Which platform is not working when running code? Could you minimize code to just what is needed to reproduce the problem?
First of all, it looks like you are using Xamarin.Forms, but I am using Xamarin.Android. Here is a sample & screenshot of my code:
And here is the code from databuttonborder (the
Drawableused as my background):
android:paddingBottom="5dp"just adds more whitespace to the bottom of the
Button(it does not move the text). How can I actually move the text (get rid of whitespace at the top)?
We cannot get rid of all of the wihtespace, but we can move the text to upper.
Please add the following properties to your Button.