Identifying RTL language in Android

前端 未结 16 1750
既然无缘
既然无缘 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:28

    There's a really simple way to check the layout direction of a view, but it falls back to LTR on pre API 17 devices:

    ViewUtils.isLayoutRtl(View view);
    

    the ViewUtils class comes bundled with the support v7 library, so it should be available already if you're using the appcompat library.

提交回复
热议问题