Based on the Android document which doesn't give much explanation, what's the difference between setPadding()
vs setPaddingRelative()
?
setPaddingRelative
has this code inside:
switch(getResolvedLayoutDirection()) {
case LAYOUT_DIRECTION_RTL:
setPadding(end, top, start, bottom);
break;
case LAYOUT_DIRECTION_LTR:
default:
setPadding(start, top, end, bottom);
}
So when you set padding with setPaddingRelative
it changes left and right padding values depending on user's layout direction.