RN

ReactNative 绝对坐标absolute和相对坐标rel

2016-09-25  本文已影响499人  滕的世界

绝对坐标absolute

<View style={[styles.circle, {position: 'absolute', bottom: 0, right: 0}]} />
右下角
<View style={{flex: 1, backgroundColor: 'gray'}}>
    <View style={{height: 100, backgroundColor: 'green'}}>
        <View style={[styles.circle, {position: 'absolute', bottom: 0, right: 0}]}/>
    </View>
</View>
Paste_Image.png

相对坐标relative

<View style={{ flex: 1, backgroundColor: 'gray' }}>
    <View style={{ height: 100, backgroundColor: 'green'}}>
          <View style={[styles.circle, {position: 'relative', left: 0, top: 0 }]} />
          <View style={[styles.circle, {position: 'relative', left: 0, top: 0 }]} />
    </View>
</View>
Paste_Image.png

relative理解还不到位,用到的大都是left+top,以后补充

参考文章:
http://www.infoq.com/cn/articles/react-native-layout/

上一篇 下一篇

猜你喜欢

热点阅读