android determine if device is in right to left language/layout

后端 未结 8 1896
予麋鹿
予麋鹿 2020-12-09 07:49

Is there a way to determine if the device is in a right to left language (something like Arabic) as opposed to something that\'s left to right (English)?

Something c

相关标签:
8条回答
  • 2020-12-09 08:43

    If you are using Core KTX

    you could use:

    if (Locale.getDefault().layoutDirection == LayoutDirection.RTL)
    
    0 讨论(0)
  • 2020-12-09 08:43

    Yes,use the Bidi.getBaseLevel() function, it will return 0 for left-to-right and 1 for right to left.

    http://developer.android.com/reference/java/text/Bidi.html#getBaseLevel()

    0 讨论(0)
提交回复
热议问题