Identifyng RTL语言的Andr​​oid语言、RTL、Identifyng、Andr

由网友(人心太狗)分享简介:有没有一种方法,以确定RTL(从右到左)的语言,除了对所有RTL语言测试语言code?Is there a way to identify RTL (right-to-left) language, apart from testing language code against all RTL languages?...

有没有一种方法,以确定RTL(从右到左)的语言,除了对所有RTL语言测试语言code?

Is there a way to identify RTL (right-to-left) language, apart from testing language code against all RTL languages?

由于API 17+允许多种资源的RTL和LTR,我想,应该有一种方法,从API 17至少。

Since API 17+ allows several resources for RTL and LTR, I assume, there should be a way, at least from API 17.

推荐答案

从Configuration.getLayoutDirection():

Configuration config = getResources().getConfiguration();
if(config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
    //in Right To Left layout
}
阅读全文

相关推荐

最新文章