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. :)
Related
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"
this is what I tried and nothing works looked everywhere but found nothing
str.setTypeface(notoKyfiBold);
str.setText("دوس هنا للكتابه");
str.setTextColor(Color.BLACK);
str.setGravity(Gravity.CENTER);
str.setFocusable(false);
str.setFocusableInTouchMode(false);
str.setCursorVisible(false);
str.setClickable(false);
str.setMaxLines(15);
str.setEnabled(false);
str.setActivated(false);
str.setSingleLine(false);
str.setMaxTextSize(50);
str.setKeyListener(null);
str.setMinTextSize(0);
str.setHintTextColor(Color.TRANSPARENT);
str.setBackground(null);
str.setBackgroundColor(Color.TRANSPARENT);
str.setSizeToFit(true);
str.setPadding(10,0,10,0);
str.endBatchEdit();
str.setDrawingCacheBackgroundColor(Color.TRANSPARENT);
str.getPaint().setStrokeWidth(4);
str.setHighlightColor(Color.TRANSPARENT);
str.getPaint().setStyle(Paint.Style.STROKE);
the line is the one directly below the text, not that bottom border:
If you want to do it programmatically, then you can use the following code.
//assume an EditText object with name myEditText
myEditText.setInputType(myEditText.getInputType() | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS does not seem to work as expected on all keyboards whereas InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD has the drawback that it also disables toggling the language in the keyboard and the swipe gesture to add the text.
Just add following attribute in your edittext block in xml file:
android:inputType="textNoSuggestions"
This is because of suggestions. You can turn them off using
android:inputType="textNoSuggestions"
Add below lines in EditText block
android:background="#null"
android:inputType="textNoSuggestions"
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"
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.
I have an edittext for reply to email. i want to give three properties for edittext like Multiline, First character caps and disable word suggestions.
I gave like this in xml...
android:inputType="textCapSentences|textVisiblePassword"
I tried in code also... etMessage.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
I am not able to give multiline....how can i achieve this
thanks
I found solution for this problem
Just set the following parameters in xml file..
android:inputType="textCapSentences|textVisiblePassword"
These are for setting first letter of sentence to caps and disable suggestions
and write following code in ur Activity
edittext.setSingleLine(false);
Try setting android:inputType="textMultiLine|textCapSentences|textVisiblePassword". What might be happening is that it is multiline but only one line is currently shown, in which you could say android:minLines="5" or so.