如何在Android中的布局上覆盖RTL支持 [英] How to override RTL support on a layout in Android

查看:166
本文介绍了如何在Android中的布局上覆盖RTL支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在AndroidManifest.xml的<application>标记中设置了android:supportsRtl="true",但是我仍然要强制其中一个视图为从左到右,即使界面是希伯来语或阿拉伯语.如何在RTL应用程序中强制将特定视图设为LTR?

I set android:supportsRtl="true" in the <application> tag in AndroidManifest.xml, but I need to force one of the views to be left-to-right nonetheless, even when the language of the interface is Hebrew or Arabic. How can I force a specific view to be LTR in an RTL application?

具体地说,即使语言是从右到左,我也想强制某些线性布局从左到右,而不是默认的从右到左.

Specifically, I want to force some linear layout to go left-to-right instead of the default right-to-left even when the language is right-to-left.

推荐答案

通常gravity="left"足以迫使文本从左到右.但这对线性布局的方向没有帮助.解决方法是添加android:layoutDirection="ltr".

Generally gravity="left" is enough to force text to be left-to-right. But it didn't help with the direction of a linear layout. The solution was to add android:layoutDirection="ltr".

这篇关于如何在Android中的布局上覆盖RTL支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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