I’ve recently created a new feature request for the AOSP code related to padding and margin attributes used in layout declarations.
Quite often, while setting a padding or a margin, it’s done using the same value for left and right (or start and end) and for top and bottom: that’s the case for example for list row or main Activity/Fragment layouts.
Something like this (I didn’t use dimens intentionally):
android:paddingLeft="16dp" android:paddingRight="16dp" android:paddingTop="8dp" android:paddingBottom="8dp"
If you have enabled RTL support and your app works with versions earlier than Android 4.2, it would be even worst:
android:paddingLeft="16dp" android:paddingStart="16dp" android:paddingRight="16dp" android:paddingEnd="16dp" android:paddingTop="8dp" android:paddingBottom="8dp"
Of course, you can and should declare styles, but still, it’s too much XML code to write.
It would be nice to have the option to quickly set these values without having to provide all of them. Something like:
This will set a 16dp padding on both sides of the view, horizontally, and a 8dp padding on both sides vertically. That would also apply for margins.
You can find it at the AOSP issue tracker here: if you think it could be helpful, please star it, otherwise stop by anyway to leave a comment, criticise or propose another solution. In the end, the ultimate goal is to simplify our life of Android developers.