Android programmatically disable autocomplete/autosuggest for EditText in emulator

后端 未结 12 529
鱼传尺愫
鱼传尺愫 2020-12-03 02:37

Targeting Android 2.2

I have read the answers to the following questions:

Turn off autosuggest for EditText?

Android: Multiline & No autosuggest

相关标签:
12条回答
  • 2020-12-03 03:12

    Using android:inputType="textNoSuggestions|textVisiblePassword" for Edittext fix the problem.

    0 讨论(0)
  • 2020-12-03 03:13

    In the layout XML, add the following attribute to your EditText:

    android:inputType="text|textNoSuggestions"
    

    If neither this, nor the above approaches work, then this is almost certainly a problem with the emulator and the other device, and you should contact the manufacturers directly.

    See also: android:inputType (note that EditText is a subclass of TextView, which is why this attribute also works for EditTexts).

    0 讨论(0)
  • 2020-12-03 03:14

    Try This android:importantForAutofill="no"

    0 讨论(0)
  • 2020-12-03 03:15

    personally, this code help me:

    autoCompleteTextView.setAdapter(null);
    autoCompleteTextView.setText(address);
    autoCompleteTextView.setAdapter(adapter);
    

    I want to disable suggestions when I set text so I remove the adapter and after I call setText, I return it.

    so if you want to disable suggestion just use:

    autoCompleteTextView.setAdapter(null);
    
    0 讨论(0)
  • 2020-12-03 03:15

    'oninput' event in the input, ran the following function:

    function RefreshAutoComplete(elm) {
    elm.keyup();
    elm.focus();
    }
    

    I run the auto complete manually, and it works

    Thank you all for the help

    0 讨论(0)
  • 2020-12-03 03:16

    For Vodafone 845 (2.1), huawei 8800 (2.2) devices, textVisiblePassword seems to prevent word prediction.

    vendorId.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    

    or

    android:inputType="textVisiblePassword"
    

    [Edit] this answer is quite old and I don't have the environment anymore to test to get up-to-date info for comments here, sorry.

    0 讨论(0)
提交回复
热议问题