Note that there are some explanatory texts on larger screens.

plurals
  1. POEditText: Toggle InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
    primarykey
    data
    text
    <p>I've created a custom <code>EditText</code> by extending <code>android.widget.EditText</code>.</p> <p>I would like to have the auto correct spans only visible, when the <code>EditText</code> has focus. So I call <code>setInputType(INPUT_NO_FOCUS);</code> in the constructor and:</p> <pre><code>@Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { super.onFocusChanged(focused, direction, previouslyFocusedRect); if (focused) { setInputType(INPUT_FOCUS); } else { setInputType(INPUT_NO_FOCUS); } } </code></pre> <p>with:</p> <pre><code>private final int INPUT_NO_FOCUS = TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; private final int INPUT_FOCUS = TYPE_CLASS_TEXT | TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_AUTO_COMPLET; </code></pre> <p>==> There is indeed no auto correction and auto complete, but it does not appear after clicking on the <code>EditText</code>. Input type is changed successfully.</p> <p><strong>How can I trigger the auto correction/ add auto completion?</strong></p> <p>//Edit:</p> <p>User Case I want to archive:</p> <ol> <li><p><code>MyEditText extends EditText</code> view is displayed and not focused. There is no spell checking on the text (--> No red spans/lines under the text)</p></li> <li><p>User clicks into the edit field to. --> Spell checking gets triggered --> Red lines appear (User can click on wrong spelled words and let the OS correct them)</p></li> <li><p>User clicks on another View element --> Red lines/spans disappear.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload