Identifying RTL language in Android

前端 未结 16 1713
既然无缘
既然无缘 2020-11-28 06:59

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

Since API 17+ allows several resources for RTL a

16条回答
  •  旧巷少年郎
    2020-11-28 07:27

    Easily you can use this :

     if (getWindow().getDecorView().getLayoutDirection()== View.LAYOUT_DIRECTION_RTL) {
            // The view has RTL layout
        } else {
            // The view has LTR layout
        }
    

提交回复
热议问题