How to reliably disable autosuggest on EditText? - android

I am trying to disable autosuggest on this EditText, but all the methods outlined don't work with the Japanese IME keyboard and Swype. Is there a way to make it work correctly?
So far, I've tried everything in all kinds of combinations to no avail. Although all solutions work perfectly fine with the default keyboard, users report they still get autosuggest. This is a word game that needs word starting with certain letters, so I really need it.
<EditText
android:id="#+id/txtWord"
android:background="#drawable/textbox_bg"
android:layout_margin="5dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="right|center_vertical"
android:layout_weight="1"
android:singleLine="true"
android:inputType="textFilter|textNoSuggestions|textVisiblePassword"
android:imeOptions="actionNone"
>
<requestFocus />
</EditText>

Everything supplied to attributes like android:inputType are suggestions to the IME, not commands. Some IMEs will honor them, some will not. Hence, you are going to need to design your game such that either you do not care about the suggestions or you do not use an EditText widget.

InputType.TYPE_NULL or 'none' (check the System level attributes for specifics) should work in most cases, but as Mr Murphy says, they're just hints, so may not work (and presumably you can't OR is it anything else).

You can use this :
android:inputType="textNoSuggestions"
android:privateImeOptions="nm"

Related

Remove the underline when typing word in EditText

I know, the question has already been asked many times on this forum, but no answer worked for me...
When I write in one of my EditTexts, the word being written is underlined, and I would like it not to be underlined... I've already seen answers like "You have to change the android:background", or "You have to put the textNoSuggestions attribute in android:inputType"... But I've already done all that - see the code just below - (and I even keep them by default) and it doesn't work.
A really huge thank you to everyone who will take the time to answer this question!
XML EditText :
<EditText
android:id="#+id/editP1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="4dp"
android:autofillHints="username"
android:background="#drawable/background_card"
android:gravity="center_horizontal"
android:hint="#string/player_name"
android:imeOptions="flagNoFullscreen"
android:inputType="textFilter|textNoSuggestions"
android:maxLength="12"
android:padding="4dp"
android:textSize="25sp" />
<!-- The ' android:imeOptions = "flagNoFullscreen" ' was only necessary to show the underline word since my app is always in landscape mode -->
Pictures :
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).

Android: imeOptions doesn't work despite using maxLines and inputType

I want the soft keyboard in my app to show Done when clicking on a particular EditText. This is how it looks
<EditText
android:id="#+id/code_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/enter_code_textView"
android:layout_marginStart="#dimen/margin_25dp"
android:layout_marginLeft="#dimen/margin_25dp"
android:layout_marginTop="#dimen/margin_12dp"
android:layout_marginEnd="#dimen/margin_25dp"
android:layout_marginRight="#dimen/margin_25dp"
android:background="#drawable/edittext_background"
android:maxLines="1"
android:inputType="text"
android:imeOptions="actionDone"
android:textColor="#color/black"
android:textCursorDrawable="#null"
android:textSize="16sp" />
But this doesn't work. The soft keyboard enter key text doesn't change at all. I tried this on multiple devices, one Oreo and one KitKat. I also tried using singleLine attribute but that doesn't work too. What am I missing here? Thanks in advance!
There's no way to force the soft keyboard to show any key, not even the imeOptions. The keyboard app uses that as a hint- it doesn't have to honor it. And remember that every different keyboard will make different choices on whether or not to honor it. And that there is no such thing as the "default keyboard" as many OEMs replace it. Basically, you can set the imeOptions and hope it works, but there's no way to force it to work across all devices and keyboard apps.

Android EditText doesn't show keyboard hint if use more than one inputType attribute

I'm trying to have an Edit text with keyboard hints and auotcorrection for words (such as when you write a message in whatsapp).
This is my code:
<EditText
android:id="#+id/autoCompleteTextView1"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_margin="20dp"
android:layout_weight="1"
android:background="#color/white"
android:ems="10"
android:inputType="textCapSentences|textMultiLine|textAutoCorrect|textAutoComplete"
android:scrollHorizontally="false"
android:hint="#string/note_content"
android:textColor="#color/black_text" />
According with the documentation it should work but it doesn't.
I've also tried using the deprecated android:autoText="true".
I need all the functionallity specified in the InputType
Edit:
After some try I discovered that if I set only one attribute without problem but if I set all of what I need nothing work correctly.
Edit 2:
What I want to obtain is something like the Whatsapp editbox where you write your message.
Maybe it has to do with the input type, have you tried single combinations?
Using a combination of textAutoCorrect and textAutoComplete might not always work

Why should I use TYPE_TEXT_VARIATION_PERSON_NAME (textPersonName)

I have here an EditText which I copied from a dialog example. The textPersonName however doesn't capiltlize like I would expect, which is to put the keyboard into caps before each word in their name. I find myself using textCapWords to achieve this.
<EditText
android:id="#+id/player_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" >
</EditText>
What is the point of textPersonName and what might I be loosing switching to textCapWords? I thought maybe there was some locale logic behind textPersonName, but it doesn't seem to even work in English like I would expect so I'm not so sure.
Edit
I have also tried android:inputType="textCapWords|textAutoComplete|textPersonName" to see if it would auto complete peoples names, but it doesn't seem to.
You don't lose anything if you stop using it. Currently Android doesn't use this flag at all. At least I checked the source code of the latest Android, and I didn't find any mentioning of this parameter in widgets.
It is possible that this is something that will be used in the future versions of Android, so I would leave it just in case, but you'll do fine without it.

Edittext set for password with phone number input? (android)

How do I get a Edittext with both a phone input and the ability to hide the string. I know that
android:inputType="textPassword"
hides the string, while
android:inputType="phone"
brings up a dialpad interface.
How to combine the two?
android:password is deprecated, but AFAIK is the only way because android:inputType="phone|textPassword" is ignored ...
<EditText
android:id="#+id/EditText01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:password="true"
android:inputType="phone" />
I believe this is what you want?
android:inputType="numberPassword"
Edit: At the time of the question (2010) this may have not been in the API, but for contemporary development, it's available.
I have not found an appropriate solution to this problem. dtmilano's accepted solution doesn't fully work. If the EditText is focused in landscape mode where you have the full screen keyboard, the numbers still display in clear text, not masked.
I spent significant time going through the actual TextView code, and the reason this is a problem is that they are explicitly checking the InputType against InputType.TYPE_CLASS_TEXT and, if I recall correctly, TYPE_MASK_CLASS. So if you include any other InputType within those bounds (I think the range used by TYPE_CLASS_TEXT and TYPE_MASK_CLASS is the first byte), then it won't be recognized as a password that needs masking.
I know what I said is pretty confusing. The actual code is a LOT more confusing. I was pretty appalled at the TextView's code to be honest. It's a tangled mess, with hard coded checks everywhere. Horrible coding practice which leads to problems like this.
This problem can be solved without using deprecated android:password. See my answer here.
I haven't tried this, but it might be possible to combine the two like so:
android:inputType="textPassword|phone"
since inputType can take on multiple values.

Categories

Resources