正常的布局方向为LTR,但有些语言需要反向,比如阿语,是RTL的, 那么会在androidManifast.xml 中application
标签中增加 android:supportsRtl="true" 来自动适配LTR和RTL 。
但是这种适配是自动根据布局适配的,比如直接绘制的布局。
这就需要根据语言绘制不同布局了。
如下方法可以获取是
import android.text.TextUtils; import android.view.View; import java.util.Locale;
public static boolean localeLaSupportRtl() { if ((TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL)) { return true; } return false; }
7872

被折叠的 条评论
为什么被折叠?



