Protip : Easily add RTL support with new databinding library-1.

Without worrying about sdk levels, and using support library, you can easily use databindng to add RTL support. I have used two attributes "paddingHorizontal" and "paddingVertical" and used ViewCompat to set padding regarding to RTL. Here is the code.

In XML:
<LinearLayout
app:paddingVertical="@{@dimen/activity_vertical_margin}"
app:paddingHorizontal="@{@dimen/activity_horizontal_margin}">

@BindingAdapter("paddingHorizontal")
public static void setPaddingHorizontal(View view,@DimenRes float paddingDimen) {
int padding = (int) (paddingDimen * view.getContext().getResources().getDisplayMetrics().density + 0.5f);
ViewCompat.setPaddingRelative(view, padding, view.getPaddingTop(), padding, view.getPaddingBottom());
}

@BindingAdapter("paddingVertical")
public static void setPaddingVertical(View view, float paddingDimen) {
int padding = (int) (paddingDimen * view.getContext().getResources().getDisplayMetrics().density + 0.5f);
ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), padding, ViewCompat.getPaddingEnd(view), padding);
}

After reading +Lisa Wray 's post on typefaces[1], and boolean visibility[2] and +Luis G. Valle ' post about tint[3]. This is one more proof how databinding is useful to overcome some trivial problems we used to face. 


[1]https://plus.google.com/+LisaWrayZeitouni/posts/LTr5tX5M9mb
[2]https://plus.google.com/+LisaWrayZeitouni/posts/5DQGiNbne5W
[3]https://plus.google.com/+LuisGonz%C3%A1lezValle/posts/YjUcVJ14Rf5
Shared publiclyView activity