在 Android 上禁用自动布局更改 [英] Disable automatic layout change on Android

查看:45
本文介绍了在 Android 上禁用自动布局更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个应用程序,我已经对其进行了测试,并且在我的手机上运行良好.但是...当我将 .apk 提供给电话语言为 RTL 的其他人时,整个布局都被破坏了,并且把一切都搞砸了.

I've made an app, I've tested it and it was fine on my phone. But... when I gave the .apk to someone else whose phone language is RTL the whole layout broke and it messed up everything.

我的问题是 - 如何强制我的应用程序仅使用 LTR 并禁用破坏我整个应用程序设计的自动布局更改?

My question is - How can I force my app to use only LTR and disable the auto layout change which breaks my whole app design?

推荐答案

在您的清单文件和应用程序标签内添加这两行.

In your manifest file and inside the application tag add these two lines.

<manifest>
    <application
        .
        .
        .
        android:supportsRtl="false"
        tools:replace="android:supportsRtl" //(replace libraries' Rtl support with ours)
        >
    </application>
</manifest>

注意:(关于第二行)一些库在其清单文件中支持 Rtl,因此如果您想使用这些库,您必须用您的清单替换它们的清单代码行.

Note: (about second line) Some libraries have support Rtl in their manifest file so if you want to use those libraries you must replace their manifest line of code with yours.

这篇关于在 Android 上禁用自动布局更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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