ReactNative 适配Android的沉浸式布局


配置


  1. 在res/value/styles中配置状态栏的背景颜色
    
  1. 在manifest中定义使用AppTheme
 
  1. 在MainActivity的onCreate方法中使得页面全屏显示
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            Window window = getWindow();
            window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    }

你可能感兴趣的:(ReactNative 适配Android的沉浸式布局)