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
Related
I need edittext with auto suggestion turned on.
For this I am using following in xml :
<EditText
android:id="#+id/edt_description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#null"
android:hint="#string/description_album_hint"
android:imeOptions="actionNext"
android:inputType="textCapSentences|textAutoCorrect|textAutoComplete"
android:maxLines="2"
android:minLines="2"
android:singleLine="false"
android:textColor="#color/black"
android:textColorHint="#color/hint_color_light_gray" />
Even if I add "textCapSentences|textAutoCorrect|textAutoComplete" as inputType still there are no suggestions.
Adding Screenshot (this is what I need to implement):
Please help me.
Thanks in advance.
For this purpose you need a subclass of EditText called AutoCompleteTextView. You can find an example here http://developer.android.com/guide/topics/ui/controls/text.html#AutoComplete
If you want to get auto suggestions in top of your keypad, what ever you are following is correct. Additionally you can add android:autoText="true". The suggestion will show you all your previously entered words.
Else if you want to get suggestion for every letter you type, then you can use AutoCompleteTextView.
Here is the code, how you can use this.Ex - AutoCompleteTextView
Got it .....
just removing "textAutoComplete" from "textCapSentences|textAutoCorrect|textAutoComplete" worked for me.
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 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
I tried to show a hint in the EditText of my form, but i can't see that hint that i have set in the XML Layout while my application gets deployed, but i can able see the hint in eclipse designer view, but while getting deployed the same hint suppose to appear is missing, i tried with all the possible ways still i could not get the hint in the EditText... This is one of the Edit Text layout that i have used..
<EditText android:id="#+id/SetTimerSec_EditText01"
android:layout_width="60sp"
android:layout_height="40sp"
android:singleLine="true"
android:layout_x="220sp"
android:layout_y="170sp"
android:hint="0"
android:inputType="phone"
android:textColorHint="#color/black"
android:gravity="center"
android:focusableInTouchMode="true" />
[link text][1]
Can anybody Help me..Please
Thanks in advance
[1]: http://imgur.com/PzomF.jpg
[ScreenShot of Designer View with hint displayed][1]
It seems like a SDK bug, or at least related to one.
http://code.google.com/p/android/issues/detail?id=7252
The hint shows up if you remove the following:
android:gravity="center"
add android:ellipsize="start" and your hint will show up and be centered!