Android之如何判断当前是阿拉伯布局的方法
生活随笔
收集整理的這篇文章主要介紹了
Android之如何判断当前是阿拉伯布局的方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 問題
判斷當前是不是阿拉伯布局的方法
2 幾種判斷方法
@SuppressLint("NewApi")public static boolean isLayoutRtl(View view, Resources res) {if (res == null || view == null) return false;Locale curLocale = res.getConfiguration().locale;//如果當前語言是ar(阿拉伯語言)或者fa 一定是阿拉伯布局if (curLocale != null) {Log.i(TAG, "curLocale is:" + curLocale.toString());//如果是ar語言,一定是阿語布局if ("ar".equals(curLocale.toString().trim()) || "fa".equals(curLocale.toString().trim())) {return true;}}if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {boolean firstResult = false, secondResult = false, thirdResult = false, fourResult = false;總結
以上是生活随笔為你收集整理的Android之如何判断当前是阿拉伯布局的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android之SubsamplingS
- 下一篇: Android之实现RTL的ViewPa