我做了類似今天這樣的:
<View style={{ flex: 1 }}>
<View style={{
height: 350,
backgroundColor: "blue"
}}>
<View style={{
backgroundColor: "red",
height: 100,
width: 100,
position: "absolute",
top: "50%",
left: "50%",
marginLeft: -50, // Half the width of this child
marginTop: -50 // Half the height of this child
}}>
<Text>Hello...</Text>
</View>
<View style={{
backgroundColor: "green",
height: 30,
width: 100,
position: "absolute",
top: "50%",
left: "50%",
marginLeft: -50, // Half the width of this child
marginTop: 70 // This just controls how far down from center this child is
}}>
<Text>...world</Text>
</View>
</View>
但這也需要你知道父裏面的元件的尺寸,不過這樣你就可以正確設置對孩子的marginLeft和marginTop值。