How to remove the double underline from EditText? [duplicate] - android

How can I disable spelling corrections in an EditText's soft-keyboard programmatically in Android? The user can disable it from settings, but I need to disable it in my application.
Is there any way to do this?

Set this in your layout's xml for your EditText:
android:inputType="textNoSuggestions"
Or call setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS) in your Activity'
If you need to support API 4 and below, use android:inputType="textFilter"

If setting:
android:inputType="textNoSuggestions"
still doesn't work (and your text field is small), a quick work-around is to use:
android:inputType="textVisiblePassword"

Related

How to disable auto suggestion of Edit text in Android version 10 i.e. Android Q?

I have tried all the options which are available i.e. textNoSuggestions, textFilter, textMultiline. But they didn't work for me. So, after using all these I even tried to set inputType from java file but even that didn't work either.
I have my EditText in ConstraintLayout.
Thanks in advance.
You can use below inputType and it will work -
android:inputType="textVisiblePassword"
Hope this will help you.
Looks like this is not autosuggestion but autofill. Make sure you've not set android:autofillHints and remove it if it is set.
You can also try to set android:importantForAutofill="no"

android - avoid text to be underlined in EditText

When I write a text in an EditText it gets underline until I hit the space key. I've tried:
android:inputType="textNoSuggestions"
But it's not helping
If you are talking about the default 'underlining' of EditText, try setting its background to transparent.
try to add following lines in java code-
mEditText.setHorizontallyScrolling(true);
mEditText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
If you need to support API 4 and below, use android:inputType="textFilter"

Change "Done" button in Android numeric keyboard

I have an EditText in Android configured for the number keyboard, and I would like the keyboard's button to say "next", while mine is saying "done".
How can I change that?
I already tried:
<com.innovattic.font.FontEditText
style="#style/CadastroTextBoxStyle"
android:hint="CEP"
android:id="#+id/etCEP"
android:inputType="number"
android:singleLine="true"
android.imeOptions="actionNext" />
And also this:
etCEP.setImeActionLabel("Next", KeyEvent.KEYCODE_ENTER);
But it still says done.
What else can I do?
Thanks
As can be seen in Specifying the Input Method Type, you do not need to call TextView.setImeActionLabel(CharSequence, int) and you have to instead just provide a android:imeOptions value such as actionSend or actionNext in XML attributes to change the label accordingly.
This is not working for you because you have mistyped : as . in your attributes. Switching those out should fix your issue in no time.

how to disable spellcheck Android edittext

I want to remove the underlines from texts inside edittext fields.
How can I do that?
You can do it with following code. Just paste it in layout of EditText.
android:inputType="textNoSuggestions"
In order to get rid of spell checking you have to specify the EditText's InputType in the XML as the following:
android:inputType="textNoSuggestions"
However, if your EditText is multiline and also you need to get rid of spell checking,then you have to specify the EditText's InputType in the XML as the following:
android:inputType="textMultiLine|textNoSuggestions"
Minor addition to Chintan's answer - such (and other) combination is also allowed:
android:inputType="textCapSentences|textNoSuggestions"
Or if you want to just disable the red underline (and the autocorrect dialog), you can override the isSuggestionsEnabled() method on TextView.
This will keep the keyboard autocomplete working.
I just Added a line in for EditText
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
and it worked fine for me.
So I was not able to find out any direct way of doing it. So went ahead with below workaround:
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
As the input type becomes a visible password, even if the spell check is enabled from the device settings, the Red underline won't appear. :)

Android: inputType none and physical keyboard

I have a problem with TextEdit,
if I do editText.setInputType(InputType.TYPE_NONE); the user is not able to type anything.
Anyway, if there is a physical keyboard attached, then the user can type by using it (of course the soft keyboard doesn't work).
Is there any way to fully disable editing on a EditText?
PS: I need to do that programmatically at runtime
Try
android:editable="false"
in xml layout file
android:editable="false" is deprecated ,prefer not to use it.
Another solution to this that I used is given below
first_password_EditTextBox = (EditText) findViewById(R.id.editText1);
first_password_EditTextBox.setEnabled(false);

Categories

Resources