I want to remove the blue line from edittext when i touched edittext it appear but i dont know how to remove it. see the picture for more understanding
do it this way
lUserNameEditText.clearFocus();
another way which works for me regarding the border is
lUserNameEditText.setBackgroundColor(0);
Have you tried changing the Layout XML like this
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:background="#00000000"
/>
or do it via code
editTextView.setBackgroundColor(0);
remove requestFocus tag in xml layout so automatically focus will loss
Related
How can I display a text error with setError in an EditText not focusable? It's important that users don't modify this EditText, it'll be modified for the application. Maybe I have another option different than focusable=false?
Now, I have it:
<EditText
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:ems="10"
android:focusable="false"
android:inputType="text"
android:onClick="onClick" />
Thanks a lot!
Finally I think it's not possible to do... Because the first necessity is to block the text, doing it with focusable=false or with a TextView, and it also blocks the functionality setError.
An editText with focusable = false I can get a right drawable (the default red exclamation mark) but without text. For this reason I finally added the text with a Toast.
It's not completelly that I wanted, but it's the most similar.
Thanks for your help!
Just use TextView and if you have an error somewhere then show image with drawableRight.
Here's the example of doingit programmatically: https://stackoverflow.com/a/7380789/3864698
Would it be possible to have an edit text appear to be in focus but not not actually be in focus. I would like the bright blue underline on two or more of the edit texts in my UI but never have them in focus or have the blinking insertion point. I have tried android:focusable="false" but that makes it grayed out. I'v also tried out a number of other combination but can't seem to find one that works.
Try to use
setSelected(true);
I think it will help
Edit:
To summarize I think you cannot really setSelection on multiple edittext at the same time but you can customize your editext by giving them custom background using selectors so they will look like selected.
You can accomplish it by using these tools that allow quick resources generators.
http://romannurik.github.io/AndroidAssetStudio/
Try this:
<EditText ... >
<requestFocus />
</EditText>
Hope this helps.
Programatically you can "request focus" to your view:
myEditText.requestFocus();
or via xml:
<EditText>
<requestFocus />
</EditText>
After some pretty thorough googling I still cannot figure out what the the little graphic that's displayed under the text in and EditText View is called. I would also like to remove it either using XML or programmatically. The little graphic is the thing under the cursor in this image: http://1.bp.blogspot.com/-UAuOq0h4Vok/T8reinvaWPI/AAAAAAAABPc/N4yibXd3kZg/s1600/android%2Bedittext%2Btext%2Bchange%2Blistener%2Bexample.jpg . Sorry if this is a dumb question, but without the name of this little graphic feature I can't seem to find out anything about it.
It is the background drawable associated with the edittext. You can change it by manually setting the background to something yourself, such as
<EditText
android:background="#android:color/transparent"
...
/>
Try this..
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/hello"
android:background="#00000000"
/>
if you want transparancy just put 80 before the actual hash code.
#80000000
This will change any colour you want to transparent one.. :)
you probably have in your layout
android:minLines="2"
try to remove it
I would like to know how to remove the top space/margin of a soft-keyboard.
For clearer picture, checkout the following screenshots:
With space and without space:
The "spacing" you're seeing is the autocomplete suggestion area. If you have an input type set to something as simple as text then you're going to get suggestions from the keyboard. Adding textNoSuggestions to your inputType field will remove the suggestions area.
So for example:
<EditText android:id="#+id/username_field"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions"
android:hint="#string/username" />
Or if you were already using something like textCapWords you can combine them like so:
<EditText android:id="#+id/username_field"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords|textNoSuggestions"
android:hint="#string/username" />
Also, not sure if you are using it but just a heads up, you'll want to use inputType="password" for your password field.
Whatever your inputType is, add |textNoSuggestions to the end of it.
I am having one contact form in which I would like to add some icons to my edit text for a better look. I want to create EditText something like below.
I have EditText like below. And I got the result something like. I want the image to be absolutely on the left side as it is in the above image. I know that internally EditText is using Nine Patch image and i think that is why the result is some what different. Can anyone know how to resolve this?
<EditText
android:id="#+id/name"
android:layout_width="fill_parent"
android:layout_height="51dip"
android:hint="#string/name"
android:inputType="text"
android:drawableLeft="#drawable/name_icon_edittext" />
Instead of using android:drawableLeft="#drawable/name_icon_edittext", create separateImageView for the name_icon.
This way you have more control on placing it on the layout
Note: I am assuming your layout is RelativeLayout
if you want to add some space between you text and image then use'drawablePadding' property in xml
android:drawablePadding="10dp"
here is complete example how to use in edittext in xml file
<EditText
android:id="#+id/edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_left"
android:drawablePadding="10dp" />
You can use android:drawablePadding="10dp" property in the xml file.
There's no need to create separate imagview for the icon.
A bit old, but for future reference maybe:
I would do a 9-patch image myself with the appearance you want, keeping the proportions and all but the icon, so you can add it yourself (and reuse the background) with drawableLeft property of EditText. That way only the middle part of the image will be stretched but the rest will stay the same.