Reputation: 1238
Based on the Android document which doesn't give much explanation, what's the difference between setPadding()
vs setPaddingRelative()
?
Upvotes: 50
Views: 18012
Reputation: 10518
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.
Upvotes: 70