right-to-left

How to detect whether a character belongs to a Right To Left language?

戏子无情 提交于 2019-11-26 09:25:59
问题 What is a good way to tell whether a string contains text in a Right To Left language. I have found this question which suggests the following approach: public bool IsArabic(string strCompare) { char[] chars = strCompare.ToCharArray(); foreach (char ch in chars) if (ch >= \'\\u0627\' && ch <= \'\\u0649\') return true; return false; } While this may work for Arabic this doesn\'t seem to cover other RTL languages such as Hebrew. Is there a generic way to know that a particular character belongs

Identifying RTL language in Android

不问归期 提交于 2019-11-26 08:10:13
问题 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 and LTR, I assume, there should be a way, at least from API 17. 回答1: Get it from Configuration.getLayoutDirection(): Configuration config = getResources().getConfiguration(); if(config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { //in Right To Left layout } 回答2: @cyanide's answer has the right approach but a critical bug.

How to handle RTL languages on pre 4.2 versions of Android?

混江龙づ霸主 提交于 2019-11-26 03:59:36
问题 Background TextView always had issues with RTL (Right-To-Left) languages. Since I know only how to read Hebrew (in addition to English), I will talk about its issues: Text alignment (and I\'m not talking about gravity) . As an RTL language, Hebrew puts words from right to left (compared to English which is the opposite). For demonstrating how annoying it is, imagine that instead of showing \"Hello world.\" you usually get \".Hello world\" . This could be easily fixed if you had it in a single

How to set Navigation Drawer to be opened from right to left

不问归期 提交于 2019-11-26 00:36:34
问题 First of all I know this question appeared here before but after trying a lot i still didn\'t succeed. I working on the example from Android Developers site. I\'m trying to set the menu to be opened from right to left instead of how its implementing in the example (from left to right). In addition I want to move the open menu button to the right side of the action bar. I also red some answers here, for example in this answer. I try to change the gravity of the views and the layouts but I get