visual studio – Xamarin Android Padding and Layout discrepancies


I’m programming an Android App with Xamarin and Visual Studio.
I noticed that when it comes to padding and margin (via xaml), the layouts sometimes look very different in the designer and in the different Android versions.
For example, using paddingVertical and paddingHorizontal in an ImageButton works in the designer, but in the emulator and on my test devices it never worked, I had to use paddingLeft, paddingTop, etc. instead.
When it comes to margins – I noticed that a simple layout without having any margins specified is realized with a lot of margins on my Lollipop device, but no margins whatsoever on my Nougat device.
Is there any way to anticipate how layouts will look regardless of the Android version, and furthermore, is there any documentation on what attributes work with what Android version? The documentation for paddingVertical left me clueless why it didn’t work on Devices.

Any help would be greatly appreciated 🙂


Please enter your comment!
Please enter your name here