[英]How to set the overall background color behind the view in React-Native
有没有办法在React Native中渲染的视图后面设置整体backgroundColor? 例如,如果我使用marginTop: 30
视图样式,则视图上方会有空白。 我想知道是否有一种方法可以更改此背景色?
renderStoriesListView() {
if (this.state.dataSource.getRowCount() === 0) {
return (
<Loading>top stories</Loading>
)
} else {
return (
<View style={{marginTop: 30, backgroundColor: 'black'}}>
<RefreshableListView
dataSource={this.state.dataSource}
renderRow={this.renderStory}
loadData={this.loadTopStories}
refreshDescription="Refreshing top stories"
refreshingIndictatorComponent={<Refreshing />}
/></View>
)
}
},
render() {
return this.renderStoriesListView()
}
})
尝试这个...
<View style={{backgroundColor: 'black'}}>
<View style={{marginTop: 30}}>
<RefreshableListView
dataSource={this.state.dataSource}
renderRow={this.renderStory}
loadData={this.loadTopStories}
refreshDescription="Refreshing top stories"
refreshingIndictatorComponent={<Refreshing />}
/></View></View>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.