You could create a values-ldrtl folder with a xml file called isrighttoleft.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="is_right_to_left">true</bool>
</resources>
and in your values folder the same file with:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="is_right_to_left">false</bool>
</resources>
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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…