Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
4,921 questions
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?
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
Drawable
used as my background):Setting
android:paddingBottom="5dp"
just adds more whitespace to the bottom of theButton
(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.