React Native View 组件通过阴影渲染实现组件浮现效果
发布时间:2020-12-15 07:28:04 所属栏目:百科 来源:网络整理
导读:eveation 是Android 平台都有的样式键,它是数值类型的样式键,通过在组件的周围渲染阴影效果,让用户产生组件浮现在手机上的效果。 import React,{ Component } from 'react';import { AppRegistry,StyleSheet,Text,View} from 'react-native';export defau
eveation 是Android 平台都有的样式键,它是数值类型的样式键,通过在组件的周围渲染阴影效果,让用户产生组件浮现在手机上的效果。 import React,{ Component } from 'react'; import { AppRegistry,StyleSheet,Text,View } from 'react-native'; export default class ViewProject extends Component { render() { return ( <View style={styles.container}> <View style={styles.block} /> <View style={styles.block1} /> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1,justifyContent:"space-around",alignItems:"center",backgroundColor:"white",},block:{ width:150,height:150,borderWidth:1,backgroundColor:"black",borderRadius:25,block1:{ width:150,elevation:100 },}); AppRegistry.registerComponent('ViewProject',() => ViewProject); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |