here is my code
XML Markup
<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
<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)
(focused view)
Now My Problems / Issues
Can anyone please point me to the right way to resolve the issues. Comment you anyone needs more info to answer this.
Thanks in advance.
To change the bottom line color you have to use the attribute: boxStrokeColor . You can also apply these attributes in your layout: <com. google.
You can just set the start and end padding on the inner EditText to 0dp. Here's a screenshot with Show Layout Bounds turned on so you can see that the hints go all the way to the edge of the view.
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>
Edittext bottom color
android:backgroundTint="@color/yourcolor"
To disable spellchecker add code in your Edittext xml
android:inputType="textNoSuggestions"
Create an XML file with the name "EditTextStyle.xml" in the drawable folder in your project and write the following code:
<?xml version="1.0" encoding="utf-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/r..."
android:thickness="0dp"
android:shape="rectangle">
<stroke android:width="3dp"
android:color="#4799E8"/>
<corners android:radius="5dp" />
<gradient
android:startColor="#C8C8C8"
android:endColor="#FFFFFF"
android:type="linear"
android:angle="270"/>
</shape>
Now add the following attribute to your EditText:
<EditText
android:background="@drawable/EditTextStyle"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With