InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS in Samsung

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-08 16:39:35

问题


In my app, I have an EditText, with a button to change the keyboard input type. The code:

ToggleCambiarTeclado.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View view) {
        if (ToggleCambiarTeclado.isChecked()) {

            tipoDeTecladoActual = InputType.TYPE_CLASS_NUMBER;
            imagenTeclado.setImageDrawable(getResources().getDrawable(R.drawable.keyboard_numeric));
        } else {
            tipoDeTecladoActual = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
            imagenTeclado.setImageDrawable(getResources().getDrawable(R.drawable.keyboard_querty));

        }
        editNumeroContador.setInputType(tipoDeTecladoActual);
    }
});

It works perfectly in my phone...but my boss has a Samsung, and is not changing the keyboard type in his phone.

I have tried changing it to TYPE_TEXT_VARIATION_NORMAL, TYPE_TEXT_VARIATION_VISIBLE_PASSWORD and YPE_CLASS_TEXT, neither of them are working.

Anyone knows if this is a bug? Any known workaround?

Thank you.

EDIT:

Just realized my boss has TouchPal installed. If he changes the default keyboard to the standard it works perfectly...


回答1:


Later Samsung devices have SwiftKey keyboards built in. SwiftKey intentionally decided at some point to ignore Android's InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS.

A workaround is to use InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, which is somewhat hacky, but an unfortunately common workaround.

XML variant: android:inputType="textVisiblePassword"




回答2:


Samsung's behave weirdly with most things. I've had this issue before and I seem to recall that changing the input type to email worked like a charm. Give it a try.



来源:https://stackoverflow.com/questions/33148168/inputtype-type-text-flag-no-suggestions-in-samsung

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!