
我实现了具有自定义样式的自定义edittext:
<androID.support.design.Widget.TextinputLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:hint="Username" androID:textcolorHint="@color/white" app:hintAnimationEnabled="true" app:hintTextAppearance="@style/TExtAppearance" > <com.app.farmtrace.fIEldagent.CustomVIEw.EditText_SemiBold androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:textcolor="@color/colorAccent" androID:theme="@style/EditTextStyle" androID:ID="@+ID/username" androID:maxlines="1" androID:maxLength="50" androID:inputType="textEmailAddress|textNoSuggestions" androID:nextFocusDown="@+ID/password" /> </androID.support.design.Widget.TextinputLayout>这是屏幕:
只有光标,现在当我再次选择光标时,我得到了:
我不要光标下方的黄色下划线.
这已在AndroID 7.0的Moto g4中进行了测试.
<style name="TExtAppearance"> <item name="androID:textcolor">@color/white</item> <item name="androID:textcolorHighlight">@color/white</item> <item name="androID:textcolorHint">@color/white</item> <item name="androID:textcolorlink">@color/white</item> <item name="androID:textSize">16sp</item> </style><style name="EditTextStyle" parent="Widget.AppCompat.EditText"> <item name="colorControlnormal">@color/white</item> <item name="colorControlActivated">@color/colorAccent</item> <!--<item name="colorControlHighlight">@color/colorAccent</item>--> </style>编辑
如果我seterror和错误文本不可见,也会在错误下划线:
解决方法:
我遇到了同样的问题.通过从我的TextinputEditTexts的自定义样式中删除Widget.AppCompat.EditText父样式,可以摆脱光标下划线.换句话说,我从这里更改了TextinputEditTexts的样式:
<style name="MyEditTextStyle" parent="Widget.AppCompat.EditText"> ...</style>对此:
<style name="MyEditTextStyle"> ...</style>引用样式的我的TextinputEditTexts之一的示例:
<androID.support.design.Widget.TextinputEditText androID:ID="@+ID/edit_username" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:theme="@style/MyEditTextStyle"/> 总结 以上是内存溢出为你收集整理的android-光标下划线全部内容,希望文章能够帮你解决android-光标下划线所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)