Programmatically disable auto-update on Gboard

I am trying to programmatically disable sentences using setInputType() using InputType TYPE_TEXT_FLAG_NO_SUGGESTIONS .

While this works for most keyboards, it does not work when using the "Gboard" keyboard; even with this type of input, suggestions always appear. The problem is that the user can choose whether he wants to have suggestions for the input fields, regardless of the type of input specified in EditText.

How can I suppress sentences for all keyboards, including Gboard?

+5
source share
2 answers

I found a solution:

 view.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); 

However, you can see a slight font difference between the input with and without sentences.

+1
source
 <EditText android:id="@+id/inputISD_Code" android:layout_width="0dip" android:layout_height="match_parent" android:layout_marginLeft="@dimen/dimen20" android:layout_weight="20" android:background="@null" android:fontFamily="sans-serif-light" android:hint="@string/code" android:inputType="text|textNoSuggestions" android:maxLength="10" android:textColor="@color/black" android:textCursorDrawable="@null" android:textSize="18dp" /> 
-1
source

Source: https://habr.com/ru/post/1270488/


All Articles