Identifyng RTL语言的Android [英] Identifyng RTL language in Android
本文介绍了Identifyng RTL语言的Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法,以确定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.
推荐答案
从<一个得到它href="http://developer.android.com/reference/android/content/res/Configuration.html#getLayoutDirection%28%29">Configuration.getLayoutDirection():
Configuration config = getResources().getConfiguration();
if(config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
//in Right To Left layout
}
这篇关于Identifyng RTL语言的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文