美文网首页react-native
react-native 安卓textinput 光标不显示和自

react-native 安卓textinput 光标不显示和自

作者: HT_Jonson | 来源:发表于2019-01-29 17:41 被阅读0次
                         <TextInput
                                ref={'InputText'}
                                style={styles.textInputStyle}
                                placeholder="请输入手机号"
                                clearButtonMode="while-editing"
                                selectionColor={'blue'} //这里可以设置ios的光标颜色
                                keyboardType='numeric'
                                maxLength={11}
                                underlineColorAndroid={'transparent'}
                              
                            />
    

    ios的 textinput 光标色 可以自定义,但是安卓的却 不显示.....
    试了很多方法没解决....
    最后只能寻找原生方法了

    首先 你可以去android / app / src / main / res / values / styles.xml中.
    找到如下代码

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <!-- Customize your theme here. -->
            <!-- 添加如下一行代码,这样就可以设置全局的textinput 光标色 -->
            <item name="colorControlActivated">@color/blue</item>
        </style>
    

    修改后的小伙伴可以看看了
    请注意这个是全局的光标色

    相关文章

      网友评论

        本文标题:react-native 安卓textinput 光标不显示和自

        本文链接:https://www.haomeiwen.com/subject/fpaxsqtx.html