Android应用程序用户界面的方向为从右到左的语言(阿拉伯语,希伯来语和波斯语) [英] Android app UI orientation in right to left languages (Arabic, Hebrew, and Persian)

查看:476
本文介绍了Android应用程序用户界面的方向为从右到左的语言(阿拉伯语,希伯来语和波斯语)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Simpel问题,我深表歉意,我是Android开发的新手.

I apologize for the simpel question, I am new to Android development.

我正在编写三个Android应用程序.它们全部支持从右到左的语言(特别是阿拉伯语,希伯来语和波斯语).

I am writing three Android apps. All of them supporting right-to-left languages (specifically, Arabic, Hebrew, and Persian).

每个应用程序的UI和语言将始终与OS语言无关.因此,假设操作系统语言为英语,则应用程序UI仍将以相应的应用程序语言(阿拉伯语,希伯来语或波斯语;取决于所安装的版本)显示.提及此注释很重要,因为我不会本地化其UI将根据用户的操作系统语言设置而更改的应用程序,而是创建特定于上述三种语言的应用程序.

The UI and language for each of those apps will always be irrelevant to the OS language. So, assuming the OS language is English, the apps UI will still be displayed in the corresponding app language (either Arabic, Hebrew, or Persian; depending on which version is installed). This note is important to mention because I am not localizing the app in which its UI will change based on user's OS language setting, but rather creating apps that are specific to the three languages mentioned above.

现在,我该怎么做?如何将应用程序语言设置为阿拉伯语,希伯来语或波斯语?设置此项很重要,因为例如,在LinearLayout中的android:orientation="horizontal"会从右到左显示子级的UI组件,而不是默认的从左到右的方向(例如在语言为英语时).

Now, how do I do that? How do I set the app language to be Arabic, Hebrew, or Persian? Setting this is important, because for example, android:orientation="horizontal" in LinearLayout will display the UI components of the children from right to left as opposed to the default left-to-right orientation when the language is English for example.

谢谢.

推荐答案

将容器的layout_gravity设置为正确.这将迫使它们首先与右边缘对齐.

Set the layout_gravity of your containers to right. That will force them to align to the right edge first.

此外,作为所有内容的相对布局,这样做可能会更容易.您始终可以将其对齐到右边缘或alignParentRight

Also, this may be easier to do as a relative layout for everything. You can always do an align to the right edge or alignParentRight

这篇关于Android应用程序用户界面的方向为从右到左的语言(阿拉伯语,希伯来语和波斯语)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆