的LinearLayout顺序在某些设备上扭转 [英] Linearlayout order is reversed on some devices

查看:155
本文介绍了的LinearLayout顺序在某些设备上扭转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的LinearLayout 和一些设备的所有观点是相反的。

I have a LinearLayout and on some devices all the views are reversed.

的好版本:

[b1] [b2] [b3]

在一些设备:

[b3] [b2] [b1]

为什么这种情况发生,我该如何解决?

Why does that happen and how can I fix it?

推荐答案

如果你的目标和API级别的测试> = 17(即安卓4.2),这可能是由R​​TL支持造成的,如所描述的这里

If you're targeting and testing on API level >=17 (i.e. Android 4.2) this might be caused by RTL support, as described here.

如果你不希望这样,您可以更改 安卓的layoutDirection ,了解各个特定视图(并且默认为继承,根视图就足够了),或者你可以通过设置 Android的:supportsRtl =假 在AndroidManifest.xml文件

If you don't want this, you can either change android:layoutDirection for each particular view (and since the default is inherit, the root view should suffice) or you can disable it for the whole application by setting android:supportsRtl="false" in the AndroidManifest.xml file.

或者,你也可以针对一个API级< 17,因为这将被用于兼容禁用(但这将你锁在外面某些API的)。

Or, you could also target an API level < 17, since it will then be disabled for compatibility (but this would lock you out of certain APIs).

这篇关于的LinearLayout顺序在某些设备上扭转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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