我在页面顶部有一个反应本机的视频播放器,但我希望它位于屏幕中央。我该如何实现它。这是代码
return (
<View>
<KSYVideo
source={{
uri: "rtmp://184.72.239.149/vod/mp4:bigbuckbunny_1500.mp4"
}} // Can be a URL or a local file.
ref={ref => {
this.player = ref;
}} // Store reference
volume={1.0}
muted={false}
paused={this.state.paused} // Pauses playback entirely.
resizeMode="stretch" // Fill the whole screen at aspect ratio.*
repeat={true} // Repeat forever.
playInBackground={false}
progressUpdateInterval={250.0}
style={{ height: 300, justifyContent: 'center',
alignItems: 'center' }}
/>
答案 0 :(得分:0)
尝试一下。
<View style={{justifyContent: 'center'}} >
<KSYVideo
source={{
uri: "rtmp://184.72.239.149/vod/mp4:bigbuckbunny_1500.mp4"
}} // Can be a URL or a local file.
ref={ref => {
this.player = ref;
}} // Store reference
volume={1.0}
muted={false}
paused={this.state.paused} // Pauses playback entirely.
resizeMode="stretch" // Fill the whole screen at aspect ratio.*
repeat={true} // Repeat forever.
playInBackground={false}
progressUpdateInterval={250.0}
style={{ height: 300,
alignSelf: 'center' }}
/>
</View>