我正在制作react原生博览会应用程序。我有标题,我把图像作为背景。我想把背景颜色放在这张图片上,但是当我写背景颜色的时候,它不起作用。如何在标题代码中将图像设置为背景颜色:
navigationOptions: {
headerTintColor: 'white',
headerBackground: (
<Image
source = {{ uri: "http://rapprogtrain.com/img/new/computer-2788918_1280.jpg" }}
style={{resizeMode:'cover', width: Dimensions.get('window').width,
height:250, backgroundColor:'#1e1e21' }}
/>
),
},
发布于 2019-06-10 21:22:03
您可以尝试执行以下操作:
navigationOptions: {
headerStyle: {{ backgroundColor:'#1e1e21' }}
}
发布于 2019-06-11 09:35:45
您可以使用工具栏。它可以改变背景颜色。
example.js
import {ToolbarAndroid} from "react-native"
render: function() {
return (
<ToolbarAndroid
style={{backgroundColor:'#1e1e21'}}
logo={require('./app_logo.png')}
title="AwesomeApp"
actions={[{title: 'Settings', icon: require('./icon_settings.png'), show: 'always'}]}
onActionSelected={this.onActionSelected} />
)
},
onActionSelected: function(position) {
if (position === 0) { // index of 'Settings'
showSettings();
}
}
https://stackoverflow.com/questions/56526884
复制相似问题