简体   繁体   English

屏幕右侧的Android视图

[英]Android views of the right side of the screen

I want my android app to support more languages (Hebrew), but I can't make the views appear on the right side of the scree (In Hebrew we write/read from right to left unlike English). 我希望我的android应用程序支持更多语言(希伯来语),但我无法使视图显示在卵石的右侧(在希伯来语中,我们与英语不同,从右到左书写/读取)。

I tried android:layout_gravity="right" but it didn't work. 我尝试了android:layout_gravity="right"但是没有用。

Is there a way to do this? 有没有办法做到这一点?

You can align your text from right to left, for this add this attribute 您可以从右到左对齐文本,为此添加了此属性

android:gravity="right"

to your text view, it works only if your textview width is set to "fill_parent" or to a fixed dip. 在您的文本视图中,仅当您将textview宽度设置为“ fill_parent”或设置为固定下垂时,它才有效。 I cant point out a correct solution without seeing your layout, excuse if this solution dont work for you. 如果看不到您的布局,我无法指出正确的解决方案,如果此解决方案不适合您,请原谅。

android:layout_gravity defines position of the view with respect to it's parent. android:layout_gravity定义视图相对于其父视图的位置。 android:gravity defines position of the child views of the current view. android:gravity定义当前视图的子视图的位置。

So setting android:gravity will work for you 所以设置android:gravity将为您工作

Also refer to following post to handle screens for multiple languages 另请参阅以下文章以处理多种语言的屏幕

How to get text direction in Android and change layout dynamically according to the direction? 如何在Android中获取文本方向并根据方向动态更改布局?

Also try setting android:textDirection for RTL. 也可以尝试为RTL设置android:textDirection

For more info you can go through following link: 有关更多信息,您可以通过以下链接:

http://android-developers.blogspot.in/2013/03/native-rtl-support-in-android-42.html http://android-developers.blogspot.in/2013/03/native-rtl-support-in-android-42.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM