Ruk*_*ala 2 elevation react-native
尝试添加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',
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4873 次 |
| 最近记录: |