本文介绍了Android 导航栏高度 React-Native的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 RN 使 Android 底部栏(具有后退按钮的栏)的高度正常工作.我做了以下事情:
I'm trying to get the Android Bottom bar working (the bar where you have the back button) height with RN. I did the following:
Dimensions.get('window').height
我得到了这个酒吧的高度!由于它可以或不可以存在,并且可以根据设置变大或变大,这对我来说是一个大问题.
I get the height with this bar! Since it can or cannot be there and can be bigger or larger depending on the settings, this is a big issue for me.
推荐答案
- 在iOS设备中,
screenHeight === windowHeight
; - 在底部导航栏的Android设备中,
屏幕高度=== windowHeight + statusBarHeight + bottomNavigatorBarHeight
; - 在没有底部导航栏的 Android 设备中,
bottomNavigatorBarHeight
为零. - In iOS devices,
screenHeight === windowHeight
; - In Android devices with bottom navigator bar,
screen height === windowHeight + statusBarHeight + bottomNavigatorBarHeight
; - In Android devices without bottom navigator bar,
bottomNavigatorBarHeight
is zero.
import {Dimensions, StatusBar} from 'react-native';
const DEVICE_HEIGHT = Dimensions.get('screen').height;
const STATUS_BAR = StatusBar.statusBarHeight || 24;
const WINDOW_HEIGHT = Dimensions.get('window').height;
这篇关于Android 导航栏高度 React-Native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!