【发布时间】:2019-03-03 00:47:03
【问题描述】:
我是 React 原生开发的新手。在我的应用程序中,我有登录页面,在这个登录页面中有两个文本输入。在此文本输入中没有下划线。我尝试了很多方法,但没有得到下划线。这里我的要求是需要输入文本的下划线。那么如何得到这个下划线呢?
这是我的登录表单代码。
import React, {Component} from 'react';
import {StyleSheet, Text, View,TextInput,TouchableOpacity} from 'react-native';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>SEDC</Text>
<TextInput placeholder="Acct No/User Id" style={styles.textInput} multiline={true}></TextInput>
<TextInput placeholder="Password" style={styles.textInput}></TextInput>
<TouchableOpacity style={styles.btn} onPress={this.login}><Text>Log In</Text></TouchableOpacity>
</View>
);
}
login=()=>{
alert("testing......");
// this.props.navigation.navigate('Second');
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
textInput: {
alignSelf: 'stretch',
padding: 10,
marginLeft: 50,
borderBottomColor:'#000',
margin:5,
marginRight:50,
// backgroundColor: '#000',
},
btn:{
alignSelf: 'stretch',
backgroundColor: '#01c853',
padding: 10,
margin:10,
marginLeft: 100,
marginRight:100,
alignItems: 'center',
}
});
这是我的代码的输出。
我尝试过使用borderBottomColor:'#000',但没有工作..所以请指导我如何做到这一点
提前致谢...
【问题讨论】:
-
您是否尝试过使用 underlineColorAndroid 属性。
-
谢谢@DheerajChaudhary 它工作完美