EditText has two underlines - android

Getting quite frustrated with this issue.
I have got two underlines for all my EditText and I don't know why this is happening.
How do I remove the black underline color?

The turquoise underline is part of the default EditText widget background. You can remove it by setting the background XML attribute to #null.
The black underline is likely caused by predictive text. This can be corrected by adjusting your inputType, also in XML.

Related

How to change hint text color of edittext when TextInputLayout is used

I have a screen with edittexts. When these edittexts are disabled, I need the hint color to be in one color
When these are enabled, I need the hint to be in a different color like this
This works fine when I tried like this
editText.setHintTextColor(color);
The problem is , I have to use a TextInputlayout to show the floating hint. So, When I add the EditText inside TextInputLayout this code doesn't work at all. I tried many things with TextInputLayout as shown here. But nothing works. All I need is the hint text color (Not floating hint text) of the EditText should be in one color when enabled , and in different color when disabled, when used inside a TextInputLayout. Please help!
Note: My question is not a duplicate of this question. There , it is mentioned about the floating hint text of the TextInputLayout when it is focused What I am talking about the normal hint text when the edit text is not focused and also when it is empty.
Add these to your App theme
<item name="colorControlNormal">#color/color</item>
<item name="colorControlActivated">#color/color</item>
<item name="colorControlHighlight">#color/color</item>
<item name="android:textColorHighlight">#color/color</item>

TextInputLayout: Is it possible to have different font between input field and hint text?

I have a textInputLayout with a TextInputEditText.
I would like the hint text to be in Roboto and the edit field (the text that user is entering) to be of a custom font, but can't seem to get it working. Somehow if I try to set a font on the TextInputEditText it also affects the hint text's font.
Anyone know how to get this issue solved?
*** edit: Found some weird thing. When I set the inputType to textPassword on the TextInputeditText (and have my custom font set on same widget via fontFamily=".." then I do have two different fonts on hint and edit field?!! But unfortunately for any other input type and in my case I need inputType="textEmailAddress" the hint text changes to same font as TextInputEditText
I found the solution:
You need to set typeFace on the TextInputLayout programmatically for the font you want for the hint text.
The font for the TextInputEditText fields can be set directly in either xml or programatically.
Default EditText does not offer a method to set the Typeface of the hint only, but if you set a custom typeface to your EditText, all the text fields are affected.
To obtain what you want, you need to define a custom TypefaceSpan and a SpannableString, as suggested in this topic.
Please have a look at francisco_ssb answer.

Change color line under autocomplete editext (Android)

I'm using an AutoCompleteEditText and some EditText. I have edited the color of the line under the EditText and it works but when I attempt to change the color of line under the AutoCompleteEditText, the color remains green. What can I do to solve this problem?

Ellipsize works with hint, but not with text

I have a custom edittext and I'm having some problems with the ellipisze.
My edittext is build programmatically and has the following attributes:
setSingleline(true);
setInputType(InputType.TYPE_NULL);
setCursorVisible(false);
setEllipsize(TruncateAt.END);
setText(com.telecomIT.digicare.R.string.comment_hint);
But the ellipsize isn't working. The weird thing is that if I change setText to setHint, the 3 dots are displayed.
So, why does it work with hint, but not with text?
I already tried to set the inputtype to text, but this doesn't work either.
Try changing the input type to something other than Null.

How fix error design Edittext

I design with android 4.0.3: theme.holo
When i change back color of edittext,It show lines is black color at first edittext.
How do hides black line of edittext when change background color?
Watch image: Click Here
you should be able to use
android:cursorVisible="false"
in your xml or
editTxt.setCursorVisible(false);
from java
EDIT:
Use an OnFocusChangeListener on the EditText to get a callback when it gets and loses focus and use the setCursorVisible() method to set the cursor to whichever state you need.
you can set android:textCursorDrawable="#null" in your layout

Categories

Resources