render() { const { username,password } = this.state; return ( <View style={styles.container}> <View style={styles.group}> <Text style={styles.text}>Username:</Text> <TextInput style={styles.input} onChangeText={this.handleUserNameChange.bind(this)} value={username} underlineColorAndroid="transparent" /> </View> <View style={styles.group}> <Text style={styles.text}>Password:</Text> <TextInput style={styles.input} secureTextEntry={true} onChangeText={this.handlePasswordChange.bind(this)} value={password} underlineColorAndroid="transparent" /> </View> <TouchableHighlight style={styles.button} onPress={this.handleLogin.bind(this)}> <Text style={styles.buttonText}>logon</Text> </TouchableHighlight> </View> ); }
现有款式:
const styles = StyleSheet.create({ container: { flex: 1,justifyContent: 'flex-start',alignItems: 'center',backgroundColor: '#F5FCFF',marginTop: 60 },group: { alignItems: 'flex-start',padding: 10 },input: { width: 150,padding: 2,paddingLeft: 5,borderColor: 'gray',borderWidth: 1 },text: { padding: 0 },button: { width: 150,backgroundColor: '#2299F2',padding: 15,marginTop: 20,borderRadius: 5 },buttonText: { textAlign: 'center',color: '#fff',fontSize: 24 },});
我需要一个ActivityIndicator到上面的View,覆盖视图,并使ActivityIndicator居中。