Edittext Underline Below Text Property

How to remove underline below EditText indicator?

Make background like this
android:background="@null" of your editText

How to underline an EditText

It is default, but try to check your styles. Maybe there is a style that will override the style in the whole application. If there is, just remove it

Handles of EditText are underlined

Problem is with your style themes.. parent

use below code:

<android.support.v7.widget.AppCompatEditText
android:theme="@style/MyStyle.EditText"/>

Now in your styles.xml

 <style name="MyStyle.EditText">
<item name="editTextStyle">@style/MyEditTextStyle</item>
</style>

<style name="MyEditTextStyle" parent="Widget.AppCompat.EditText">
<item name="colorControlNormal">@android:color/white</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="colorControlHighlight">@color/colorAccent</item>
</style>

try not to use the theme parent directly

EDIT

add the color property in base theme also

 <style name="Theme.App.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">@android:color/white</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="colorControlHighlight">@color/colorAccent</item>
</style>

make sure you select the theme in your activity in manifest...

How to change textinput edittext underline color when unfocused?

I had a similar problem aswell, where my focused hint color was different compared to unfocused.

The solution that worked for me is the following:

In your text input layout set android:textColorHint="@color/your_unfocused_color" for unfocused color and app:hintTextColor="@color/your_focused_color" for focused, this also changes the underline stroke color, when the state is focused.

For the underline, you need to set app:boxStrokeColor="@color/underline_colors"

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/focused" android:state_enabled="true" />
<item android:color="@color/focused" android:state_hovered="true" />
<item android:color="@color/focused" android:state_focused="true" />
<item android:color="@color/unfocused" />
</selector>

How to hide underbar in EditText

You can set the EditText to have a custom transparent drawable or just use

android:background="@android:color/transparent"

or

android:background="@null"

or Programmatically

editText.setBackgroundResource(android.R.color.transparent);

EditText with custom theme shows underline under selection handle

You can use this style as a

<EditText 
style="@style/MyTheme.EditText"/>

Or, you can separate your theme for referencing the editTextStyle attribute.

<style name="MyEditTextStyle" parent="Widget.AppCompat.EditText">
<item name="colorControlActivated">@color/green</item>
</style>

<style name="MyTheme.EditText">
<item name="editTextStyle">@style/MyEditTextStyle</item>
</style>

<EditText
android:theme="@style/MyTheme.EditText"/>

Alright, but where are these underlines come from?

android:theme is an attribute of View and when you set a style as android:theme, that style will be wrapped by ContextThemeWrapper with context theme while in inflation of view.

So that means, if you set android:theme property with style that contains android:background item like

<item name="android:background">@color/green</item>

every child view of this theme owner will be have a green background.

"Widget.AppCompat.EditText" is a style and references ?attr/editTextBackground as a "android:background". And in v21/values-21.xml file @drawable/abc_edit_text_material is defined as editTextBackground.

So, for your example, @drawable/abc_edit_text_material becomes a background of your EditText and SelectionHandlers.

Remove the underline when typing word in EditText

As outlined at Android edittext is underlined when typing, this may be a function of the keyboard in use, rather than the EditText. Without knowing which specific solutions you've tried and have failed (you say no answer worked for you, but don't list things you tried) it is hard to offer a specific suggestion, but I'd suggest the

android:inputType="textVisiblePassword|textNoSuggestions"

option and see if that works. The password should typically prevent the keyboard from suggesting things (since no suggestions are typically useful for passwords).



Related Topics



Leave a reply



Submit