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

后端 未结 8 1918
予麋鹿
予麋鹿 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:40

    You could create a values-ldrtl folder with a xml file called isrighttoleft.xml:

    
    
        true
    
    

    and in your values folder the same file with:

    
    
        false
    
    

    And finally in Code:

    boolean isRightToLeft = getResources().getBoolean(R.bool.is_right_to_left);
    

    The values-ldrtl will only be used on a device where the specific settings (e. g. Language) are right-to-left-read languages.

提交回复
热议问题