How do you disable the autocorrection/autosuggestion features in a multilined EditText?
I tried:
EditText without auto-correction, etc
Android: Multiline & No autosuggest in EditText
How can I turnoff suggestions in EditText?
How to set multiline,firstletter caps and disable suggestions on edittext
How can I turnoff suggestions in EditText?
None of the mentioned methods like "textFilter|textMultiLine|textNoSuggestions" (in any combination) worked, neither declared in XML nor programmatically changed.
It seems that the EditText-box takes either multiline or turned-off suggestions, but not both at the same time.
I think it is important to know that I'm using the HTC Desire HD with Android 2.3.3. I don't have any other device to test this.
Is this behaviour inherent to the HTC Sense UI?
Any ideas?
The inputType tag that you specify in EditText for MultiLine and NoSuggestions are flags that can be ignored by the system depending on its preferences.
But, I can confirm that android:inputType="textNoSuggestions|textMultiLine" in the EditText XML works perfectly fine in Nexus and Motorola smartphones. So am guessing its due to your test device preferences that you are facing this problem.
Related
I have a simple TextInputLayout. TextInputEditText which is inside TextInputLayout has two InputType flags -
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
and
InputType.TYPE_TEXT_FLAG_CAP_WORDS
These flags are set programmatically. It should disable suggestions and capitalize each single word which you write. It works without problem on default Android keyboard.
Unfortunately, if you use Swift Keyboard instead it ignores the second flag (it doesn't automatically capitalize the first letter of each word.
I don't have any experience with 3rd party soft keyboards. Does anybody have any idea how to solve it?
In the end, I found out that SwiftKey ignores all InputType.TYPE_TEXT_FLAG_XXX if you set them programmatically. I tried to set them in XML and it worked fine. However, it still isn't the best solution because sometimes it is necessary to set it programmatically. I somebody find some better solution please leave a comment :)
I am using the following element in the Android EditText, to have a keyboard with number and decimal for displaying a keyboard layout for amount input (for eg 22.12).
android:inputType="numberDecimal"
It is working for all devices, like Samsung, Nexus, Sony etc.
The keyboard layout looks like below.
The keyboard layout on the LG G4 looks like below.
Could anyone please help, how to have decimal keyboard for the LG G4. I have already tried the android:inputType="phone", still same issue.
I would like to stick to the decimal input, as it would not be very nice to have a full alpha-numeric keyboard, to enter amount.
Thanks in advance.
UPDATE
It seems that flag signed is not needed after all to get decimal separator, It was actually the TYPE_TEXT_FLAG_NO_SUGGESTIONS that messed up the keyboard so do not use it with number input types. Also noticed that LG keyboard looks different depending on if you set the input type from code vs. XML
END UPDATE
It seems like the combination of inputType and digits solves the problem. I have a class that extends EditText so I initialize the EditText like this:
setKeyListener(DigitsKeyListener.getInstance("0123456789.,"));
setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
I guess that because LG has bundled decimal separator and minus sign in a same button you have to configure both feature on and then disable "-" by not including it in digits.
There are 2 possible ways i can think of, but i do not have an LG make phone, so i personally couldn't test any of these. But still its worth a shot.
Try to give the input type as android:inputType="phone".
Saw this on the dev site, more details here https://developer.android.com/training/keyboard-input/style.html#Type
This one i tried a couple of years back, it worked for me, but my case was different. Specify an attribute in your EditText item in xml.
android:digits="0123456789."
What it does is, sets the view to accept numeric input and only the specific items mentioned in the digits attribute. I personally do not use it much, its more of a hack than a solution, but it gets things done. More info on the below link:
https://developer.android.com/reference/android/widget/TextView.html
Try these out, hope they help for all cases.
I have two keyboard installed- Swype and samsung. Is there any way I can force Android to show samsung keyboard on my EditText no matter what my setting is ??
Also is there a filter where I can disable text prediction??
Thank you.
You can set edittext widget's inputType for what you want like below
You can read more here
http://developer.android.com/resources/articles/on-screen-inputs.html
There is a long list of available preferences here
http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType
I'm implementing an EditText that is used to obtain an rtsp URI from the user. Though it's not a huge issue functionally, I would like to disable the default behavior of the on screen keyboard where the state of the caps key is enabled for the first character of every sentence. From what I've gathered, this cannot be done in the XML via android:inputType flags. Any pointers as to how to do this programatically would be helpful.
I'd like to include the code, but the nature of the project prevents me from doing so. But I can say that nothing fancy is being done here. The EditText itself has no other input flags in use, and the only IME option in place is the flag to disable the Extract UI in landscape. The layout is implemented via XML, not programatically, so there are no custom classes or extensions in the mix either.
EDIT: The android:capitalize constant inherited from TextView isn't working. I'm specifically targetting 2.2 on a Galaxy Tab, so I don't know if this has something to do with Samsung's OS tweaks, or if it has something to do with the capitalize constant being deprecated.
EDIT 2: Swype is the culprit for not allowing the use of the capitalize constant. Does anyone know if there is a way to make Swype play nice without having to inform the end user to disable Swype?
You can use the inherited android:capitalize attribute from TextView. It accepts none (no caps, which is what you want), sentences (capitalizes the first word of each sentence), words (capitalizes the first letter of every word), and character (all caps).
Putting this in the XML for the EditText worked to stop Swype 2.17.59.15552.t100 from forcing capitals:
android:inputType="text|textEmailAddress"
Since EditText is subclass of TextView, you should be able to use the TextView:capitalize configuration to change the capitalization scheme of the view. It looks like you might only be able to set none in xml.
I want to turn off displaying "Suggested Words" on the soft/virtual keyboard when someone is using my application (only on certain Activities). For the default Android keyboard, this can be found under 'Settings' (under Word Suggestion Settings).
Is there a way to disable it only within your application, without requiring the user to manually go and do it? I basically want the user to type words without providing any hints.
Thanks!
When developing for 2.0+, the supposed way is setting android:inputType="textNoSuggestions" (ref).
Unfortunately, suggestions are still shown on HTC Desire 2.2 (and probably other HTC Sense devices as well).
Using android:inputType="textVisiblePassword"will not help as well as the software keyboard by HTC won't allow you to switch languages.
So I stick to android:inputType="textFilter" to disable suggestions.
You can disable suggestions on the Soft Keyboard by adding the following line in the xml -
android:inputType="textNoSuggestions"
However according to this article, it may or may not be supported by the IME (the keyboard).
If this issue occurs, the below method works for sure -
android:inputType="textNoSuggestions|textVisiblePassword"
This works for me with the stock keyboard, even on HTC with 2.2
final EditText et = (EditText) findViewById(R.id.SearchText);
et.setInputType(et.getInputType()
| EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS
| EditorInfo.TYPE_TEXT_VARIATION_FILTER);
On my 6P running Nougat, nothing worked. While it is empty the suggestion bar stays up because it has the microphone icon on the right side.
In order to get rid of that, I used fingerup's suggestion in one of the comments and it worked!
So I decided to write an actual answer so people don't miss it.
To recap here's what I've used:
android:inputType="textNoSuggestions|textFilter|textVisiblePassword"
android:privateImeOptions="nm"
inputType="textNoSuggestions|textFilter|textVisiblePassword" prevents suggestions, and privateImeOptions="nm" (stands for "no microphone") prevents the bar from showing up because it still would since the mic button is in it.
So it is necessary to use both attributes because if all you do is specify no mic then the bar still shows up with recommendations.
Thx again to fingerup for mentioning the nm trick. ;)
There are two ways that I know of to disable the auto-complete. One way is through the XML by setting the android:inputType="textVisiblePassword" in the layout xml.
The other way is through code such as the following
EdtiText editTextBox = findViewById(R.id.myEditTextView);
editTextBox.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
I was facing the same issue on Samsung devices using:
android:inputType="textNoSuggestions|textFilter|textVisiblePassword"
only after setting the inputType to password and visiblePassword worked for me:
android:inputType="textPassword|textVisiblePassword"
android:inputType="textPhonetic" hides soft keyboard suggestions on Android 1.6.
hope this works for you,
editText.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES|InputType.TYPE_TEXT_FLAG_MULTI_LINE|InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
If you are using InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS in activity, it will work fine.
In case of DialogFragment, you should place InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS at
onActivityCreated() handler as below :-
#Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
EditText editTextUsername = (EditText)dialogView.findViewById(R.id.txtUsername);
editTextUsername.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
}