UI design for arabic support apps on Android

I am trying to provide Arabic language support for my Android application. Arabic support is provided by default with Android 2.3. So, I want to know if there are any changes in the user interface that I need to make, providing support for the Arabic language on Android.
Since the letters in Arabic were written from right to left, what are the limitations that I need to track in the design of the layout of the Android user interface, as well as in the coding?
Or else, Android itself will take care of reading the entered data, regardless of whether it is typed from right to left.

Can someone help me in solving this problem?

+5
source share
2 answers

I use this code and work great on it.

public static void change_setting_arabic(Context con) {
            try {
                Locale locale = new Locale("ar");

                Class amnClass = Class.forName("android.app.ActivityManagerNative");
                Object amn = null;
                Configuration config = null;

                // amn = ActivityManagerNative.getDefault();
                Method methodGetDefault = amnClass.getMethod("getDefault");
                methodGetDefault.setAccessible(true);
                amn = methodGetDefault.invoke(amnClass);

                // config = amn.getConfiguration();
                Method methodGetConfiguration = amnClass
                        .getMethod("getConfiguration");
                methodGetConfiguration.setAccessible(true);
                config = (Configuration) methodGetConfiguration.invoke(amn);

                // config.userSetLocale = true;
                Class configClass = config.getClass();
                Field f = configClass.getField("userSetLocale");
                f.setBoolean(config, true);

                // set the locale to the new value
                config.locale = locale;

                // amn.updateConfiguration(config);
                Method methodUpdateConfiguration = amnClass.getMethod(
                        "updateConfiguration", Configuration.class);
                methodUpdateConfiguration.setAccessible(true);
                methodUpdateConfiguration.invoke(amn, config);

            } catch (Exception e) {
                // TODO: handle exception
                Log.d("error lang change-->", "" + e.getMessage().toString());
            }
        }
+1
source

A small pro-tip from Roman Nurik (from the Android team):
Use START and END gravity instead of LEFT and RIGHT for better RTL support. Although constants are defined only in API 14 [0], they are backward compatible because (1) they are built-in at compile time and (2) they are functionally equivalent to LEFT and RIGHT on earlier devices due to their lower bytes:

START = 0x00800003
LEFT = 0x00000003
END = 0x00800005
RIGHT = 0x00000005

START LEFT <TextView layout_width=match_parent, gravity=start, text=[hebrew characters here]>
  TextView - = . , TextView , .

, , , , .

0

All Articles