本文介绍了包裹到TextInputLayout中时,更改EditText底行的粗细的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
XML标记
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/TextLabel">
<EditText
android:id="@+id/etContactName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Contact Name"/>
</android.support.design.widget.TextInputLayout>
样式
<style name="TextLabel" parent="TextAppearance.AppCompat">
<item name="android:textColorHint">@color/hintColor</item>
<item name="colorAccent">@color/primaryColor</item>
<item name="colorControlNormal">@color/hintColor</item>
<item name="colorControlActivated">@color/primaryColor</item>
</style>
这是输出
(普通视图)
Here is the output
(normal view)
(聚焦视图)
现在我的问题/问题
- 我希望底线更小.我应该在哪里更改它.
- 闪烁的光标未显示,如何显示.
- EditText自动突出显示拼写错误.我需要阻止它.
谁能给我指出解决问题的正确方法.评论您任何人都需要更多信息来回答此问题.
Can anyone please point me to the right way to resolve the issues. Comment you anyone needs more info to answer this.
谢谢.
推荐答案
我已经使用自定义的xml drawable解决了我的问题.也许有更好的方法,但是我找不到任何方法.以下是我用作文本框背景的可绘制对象
I've solved my issue using my custom xml drawable. There might be some better way, but I couldn't find any. following is my drawable that I'm using as background of my textbox
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<layer-list >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="0.5dp"
android:color="@color/primaryColor" />
<solid android:color="#00FFFFFF" />
<padding android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp" />
</shape>
</item>
</layer-list>
</item>
<item android:state_focused="true">
<layer-list >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="0.5dp"
android:color="@color/primaryColor" />
<solid android:color="#00FFFFFF" />
<padding android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp" />
</shape>
</item>
</layer-list>
</item>
<item>
<layer-list >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="0.5dp"
android:color="#BCBCBC" />
<solid android:color="#00FFFFFF" />
<padding android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp" />
</shape>
</item>
</layer-list>
</item>
</selector>
这篇关于包裹到TextInputLayout中时,更改EditText底行的粗细的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!