react native:andorid给iOS的navi多出20像素左右

react native:andorid给iOS的navi多出20像素左右

头部发白了


安卓普遍的navi头都多出来一点,就是statebar多了20像素,一个沉浸式的问题,暂时这样处理,这样iOS和安卓大体就差不多了



package com.qinggu.damai;

import android.view.View;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.imagepicker.ImagePickerPackage;

import java.util.Arrays;
import java.util.List;

public class MainActivity extends ReactActivity {
    /**
     * 沉浸式问题处理
     */
    void stateBartoDo() {
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    }

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        stateBartoDo();
        return "JdApp";
    }

    /**
     * Returns whether dev mode should be enabled.
     * This enables e.g. the dev menu.
     */
    @Override
    protected boolean getUseDeveloperSupport() {
        return BuildConfig.DEBUG;
    }

    /**
     * A list of packages used by the app. If the app uses additional views
     * or modules besides the default ones, add more packages here.
     */
    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
                new MainReactPackage(),
                new ImagePickerPackage()
        );
    }
}


猜你喜欢

转载自blog.csdn.net/harder321/article/details/51784812