我使用了兩個<View>來布置這個界面,我在下面的部分將<View>的邊框磨圓。這里有一個問題,螢屏的兩側沒有被填滿,有空隙。我怎樣才能處理這個問題呢?
"#">"#">"#">"#">"#">。
這是我的代碼: uj5u.com熱心網友回復: 你可以嘗試在父視圖上設定一個背景顏色,像這樣:
標籤:import React, { Component } from 'react;
import { StyleSheet, Text, View, StatusBar, Image, Alert, TouchableOpacity, Linking } from 'react-native';
export default class App extends Component {
render() {
return (
< StatusBar translucent={true} backgroundColor="transparent" barStyle="light-content" />
<View style={styles.titleBar}> //span>
</View>
<View style={styles.bodyContent}>/span>
</View>
);
}
}
//Stylesheets; }
const styles = StyleSheet.create({
titleBar: {
flex: 2,
backgroundColor: '#E9E9E9'。
},
bodyContent: {
flex: 5,
backgroundColor: '#FFFFFF',
borderTopLeftRadius: 30,
borderTopRightRadius: 30,
},
});
import React, { Component } from 'react;
import { StyleSheet, Text, View, StatusBar, Image, Alert, TouchableOpacity, Linking } from 'react-native';
export default class App extends Component {
render() {
return (
< StatusBar translucent={true} backgroundColor="transparent" barStyle="light-content" />
<View style={styles.titleBar}> //span>
</View>>
<View style={styles.bodyBackground}>/span>
<View style={styles.bodyContent}>
</View>/span>
</View>
);
}
}
//Stylesheets; }
const styles = StyleSheet.create({
titleBar: {
flex: 2,
backgroundColor: '#E9E9E9'。
},
bodyBackground: {
flex: 5,
backgroundColor: '#E9E9E9'。
},
bodyContent: {
flex: 1,
backgroundColor: '#FFFFFF',
borderTopLeftRadius: 30,
borderTopRightRadius: 30,
},
});

