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?
Related
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.
When I invoke setError on the TextInputLayout from the new Android design support library the line color does not change. But the error does successfully appear with the correct color.
This is the code I'm using:
textInputLayout.setError("Error Message");
Per the Material Design Spec for Text Fields when there is an error, the line/field color should be red.
How can I set the color of the line?
If it can be done as a side effect of invoking setError that would be great.
You can add
editText.getBackground().setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP);
After your
textInputLayout.setError("Error Message");.
How can I change EditText's background color without clearing the border?
If I call editText.setBackgroundColor(color) the orange border around the editText disappears..
Make a new style xml, and use it with the help of
editText.setBackgroundResource(R.drawable.yourstylename);
I have to create the background color for edittext means am getting the background correctly.
TestPost.this.findViewById(R.id.revieew)
.setBackgroundColor(color);
But how can i get the textcolor for these edittext .
TestPost.this.findViewById(R.id.revieew)
.setTextColor(color);
Please give me a solution ???
i have to pick the green color means have to enter the text is green....here i have done these for background color.i have to set the background color is green means have to pick the color green from color picker means the bexkground is successfully displaying...how can i set the textcolor from color picker ???
EDIT:
reviewEdit.setTextColor(color);
means am getting the color is successfully...But i didn't change the whole text.
I want to change the color for selected text alone...
For EG:
The text is : The customer is waiting for your reply means
Have to pick a color green, have to write the The customer is waiting have to display green color for these text alone.after that have to pick a color pink means have to display the for your reply as pink color.
This is exactly i need ...how can i implement these ???
((TextView)TestPost.this.findViewById(R.id.revieew)).setTextColor(color);
See the docs here
What you are doing is almost correct. The method findViewById() returns a View which you need to cast into a TextView/EditText (depending on how you have the view with that id defined in your xml) and then the method will be available for use.
EditText text = (EditText) findViewById(R.id.revieew);
text.setTextColor(color);
Try this TestPost.this.findViewById(R.id.revieew).getCurrentTextColor();
Found here: https://stackoverflow.com/a/6746131/2065418
Your method was correct for getting the color use below code
int color =editText.getCurrentTextColor();
Log.d("color", String.valueOf(color));
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