Shadow
Shadow

Reputation: 6899

Suggestion text is not displaying in android keyboard

When I use inputType as "textUri", Suggestion text input is not displaying.

 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <EditText
        android:id="@+id/editText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Enter URI"
        **android:inputType="textUri"**
        android:imeOptions="actionDone"/>

</RelativeLayout>

I tried using setPrivateImeOptions method but still suggest text is not displaying. Even I used android:inputType="textUri|textCapSentences|textAutoCorrect" but no use.

  public class CompleteEditTextActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_edit_text);

        EditText editText = findViewById(R.id.editText);
        editText.setPrivateImeOptions("com.android.internal.inputmethod:LatinIME");
    }

Upvotes: 0

Views: 208

Answers (2)

codrikaz
codrikaz

Reputation: 293

It is not your codding problem its keyboard functionality...

In google Keyboard enable this settings

enter image description here

Upvotes: 0

Shadow
Shadow

Reputation: 6899

It has been identified that the boolean value of shouldSuppressSuggestions has been implemented for TYPE_TEXT_VARIATION_URI in the path

packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/InputAttributes.java

  // TODO: Have a helper method in InputTypeUtils
        // Make sure that passwords are not displayed in {@link SuggestionStripView}.
        final boolean shouldSuppressSuggestions = mIsPasswordField
                || InputTypeUtils.isEmailVariation(variation)
               || **InputType.TYPE_TEXT_VARIATION_URI == variation**
                || InputType.TYPE_TEXT_VARIATION_FILTER == variation
                || flagNoSuggestions
                || flagAutoComplete;
        mShouldShowSuggestions = !shouldSuppressSuggestions;

Hence, When we declare "textURI" in XML, the suggested word on top of the keyboard is not displayed.

Upvotes: 0

Related Questions