加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

React-Native基础_2.样式Style

发布时间:2020-12-15 06:57:48 所属栏目:百科 来源:网络整理
导读:2.样式Style基本使用方式1 直接在View 上面写style 内容 View style={{ backgroundColor: '#07811d',flex: 1 }} Text Welcome to React Native! /Text /View方式2 StyleSheet.create定义一个style 常量,然后直接使用常量中定义好的属性export default class
2.样式Style
基本使用
方式1 直接在View 上面写style 内容
       <View style={{
                backgroundColor: '#07811d',flex: 1
            }}>
                <Text>
                    Welcome to React Native!
                </Text>
            </View>
方式2 StyleSheet.create定义一个style 常量,然后直接使用常量中定义好的属性
export default class Day0718 extends Component {

    render() {
        return (
            <View style={styles.Container}>
                <Text style={styles.Text}>
                    Welcome to React Native!
                </Text>
            </View>
        );
    }
}
const styles = StyleSheet.create({
    Container :{
        borderWidth :1,borderColor:'#c9382d',borderRadius:15,shadowColor:'#6435c9',shadowOpacity:0.6,shadowRadius:2,shadowOffset:{
            height:1,width:0,},margin:10,backgroundColor: '#c9382d',flex: 1,Text:{
        color:'#6435c9',fontSize: 26,textAlign:'center',fontStyle:'italic',letterSpacing:2,lineHeight:33,fontFamily:'Helvetica Neue',fontWeight:'300',textDecorationLine:'underline',textDecorationStyle:'dashed',});


---------------欢迎各位大神加群

----------------Android交流群:230274309

-----------------------------期待大神们的到来

------------------------一---起分享,一起进步!需要你们

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读