Linearlayout order is reversed on some devices

烈酒焚心 提交于 2019-12-19 23:19:33

问题


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

The Good Version:

[b1] [b2] [b3]

On some devices:

[b3] [b2] [b1]

Why does that happen and how can I fix it?


回答1:


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.

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.

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).



来源:https://stackoverflow.com/questions/24718173/linearlayout-order-is-reversed-on-some-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!