gpt4 book ai didi

react-native - react native 海拔高度和绝对位置

转载 作者:行者123 更新时间:2023-12-02 03:31:09 28 4
gpt4 key购买 nike

尝试将elevation(阴影)添加到View有效,但是我的第二个View(呈现圆形)隐藏在View下elevation 属性。如果删除了elevation,则带有position: 'absolute'的圆圈可以正常工作。

关于如何使用高度和位置查看绝对值有什么想法吗?

我的代码:

import React, { Component } from 'react';
import { StyleSheet, Text, View, Platform, TouchableOpacity } from 'react-native';
import { Font } from 'expo';


export default class Position extends Component {
render() {
return (
<View style={{ flex: 1, marginTop: 25 }}>
<View style={{ height: 50, backgroundColor: 'red', elevation: 3}}/>
<View style={styles.circle}><Text>HELLO</Text></View>
</View>
);
}
}
const styles = StyleSheet.create({
circle: {
position: 'absolute',
backgroundColor: 'yellow',
width: 60,
height: 60,
top: 30,
borderRadius: 100,
alignSelf: 'center',
justifyContent: 'center',
alignItems: 'center',
}
});

enter image description here enter image description here

最佳答案

通过将海拔添加到圆圈View来找到分辨率。

关于react-native - react native 海拔高度和绝对位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51821016/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com