RTL在RTL设备中被强制使用

问题描述 投票:22回答:3

新版本的React Native已经发布了对RTL设备的支持:https://facebook.github.io/react-native/blog/2016/08/19/right-to-left-support-for-react-native-apps.html 然而,似乎在RTL安卓设备中,RTL布局是强制的,并且没有办法改变它,所以现在所有的应用程序都被破坏了RTL设备。如何强制我的应用程序使用LTR?

android react-native right-to-left
3个回答
39
投票

我设法通过添加到MainApplication.java来解决这个问题:

import com.facebook.react.modules.i18nmanager.I18nUtil;

public class MainApplication extends Application implements ReactApplication {
    @Override
    public void onCreate() {
        super.onCreate();

        // FORCE LTR
        I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
        sharedI18nUtilInstance.allowRTL(getApplicationContext(), false);
        ....
    }
}

6
投票

在manifest.xml文件中,将android:supportsRtl="false"添加到您的应用程序标记中


1
投票

如果你正在使用世博会

import { I18nManager} from 'react-native';
I18nManager.allowRTL(false);

export default class <className> extends Component {



}
© www.soinside.com 2019 - 2024. All rights reserved.