TextView 重力不适用于希伯来语
我在希伯来语上有 TextView,我希望位于右侧,所以我正在做
<TextView....
android:gravity="right"
</TextView>
在某些手机上它将向右对齐,在某些手机上它将向左对齐。 我认为这取决于某些手机配置。 我该如何修复它?
谢谢。
I have TextView on Hebrew that i want to be on the right side, so i'm doing
<TextView....
android:gravity="right"
</TextView>
On some phones it will be aligned to right and on some it will be aligned to left.
I think it depends on some phone configuration.
How i can fix it ??
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这可能是一个问题。如果 Android 的问题页面中没有该问题,请考虑报告该问题。
现在,您可以尝试将
TextView
放置在ViewGroup
中来修复它。使用
wrap_content
和layout_gravity
将其正确放置在其父级中。This might be an issue. If it's not in the Android's issue page consider reporting it.
For now you can try fixing it placing the
TextView
inside aViewGroup
.Use
wrap_content
andlayout_gravity
to place it correctly inside it's parent.Android 目前不支持 BiDi 文本。一些制造商已经侵入了它,但在这成为平台的标准部分之前,您可以预期任何 BiDi 文本的使用都会导致不一致、损坏的行为。对不起。
Android currently doesn't support BiDi text. Some manufacturers have hacked it in, but until this is a standard part of the platform you can expect any use of BiDi text to result in inconsistent, broken behavior. Sorry.
如果
android:layout_height
或android:layout_weight
设置为wrap_content
,Android:Gravity
可能无法正常工作。Android: Gravity
might not work properly in caseandroid:layout_height
orandroid:layout_weight
is set towrap_content
.我找到了解决方案。如果您的文本是希伯来语,则无需设置重力,因为没有它它就会对齐。当我在视图中看到右侧的拉丁符号时,我想到了这一点。不过,SDK 布局编辑器仍然存在错误。
在 LG GT540 和三星 Galaxy S 上进行测试
I've found the solution. If your text is in hebrew, you don't need to set gravity, because it would be aligned without it. I came to this when I saw latin symbols in my views, which were on the right. Though, there is still bug in SDK layout editor.
Tested on LG GT540 and Samsung Galaxy S
如果您希望文本右对齐,请尝试使用以下命令:
if you wish the text to be aligned to the right , try using this:
发生这种情况是因为旧的 Android 版本不太支持 RTL。
对我来说最终起作用的是网络视图。
因为那时我只是使用 CSS 来设计我的文本。
如果您希望它在单击时执行某些操作,则您还需要一个 onTouchListener
将 TextView 更改为 Webview:
我的代码:
希望这可以帮助您!
This is happening because the older android versions don't support rtl too well.
For me what worked eventually was a webview.
Because then I just used CSS to design my text.
You will also need an onTouchListener if you want it to do something when clicked
change your TextView to Webview:
My code:
Hope this helps you out!
我认为这就是您正在寻找的:
I think this is what you're looking for: