如何解决如何在 React Native 中使屏幕的显示尺寸相对于 iOS 和 Android/Samsung?
我开发了一款适用于 iOS 的应用,希望将其集成到 Android/三星中。为了建立尺寸,我从 React Native 导入尺寸,然后在我的样式表中根据设备尺寸设置它们。
例如:
import {Dimensions} from 'React-Native';
<View style = {styles.container}>
<View style = {styles.header}>
</View>
<View style = {styles.middle}>
</View>
<View style = {styles.footer}
</View>
</View>
const {height}= Dimensions.get("screen");
const { width } = Dimensions.get("screen");
const styles = StyleSheet.create({
container: {
flex: 1,flexDirection: 'column',},header:{
height: height*0.1,width: width,middle:{
height: height*0.6,footer:{
height: height*0.3,
这对 iOS 很有用,但对 Android / Samsung 设备则不一样。如何使我的屏幕尺寸同时适用于 iOS 和 Android?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。