3

I want to change the name of enter button (the button circled in the image ) to search

enter image description here

so I used

  <EditText
                android:imeOptions="actionSearch"
                android:imeActionLabel="Search"


                android:id="@+id/et_PatientID"

                android:layout_width="400dip"
                android:layout_height="50dip"
                android:layout_toRightOf="@id/tv_patientID"
                android:background="@android:drawable/editbox_background" />

but it didn't work

AMH
  • 6,363
  • 27
  • 84
  • 135

1 Answers1

5

add android:imeOptions="actionSearch" and android:inputType="text" to your EditText View

also add the editor action listener

editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_SEARCH) {
            performSearch();
            return true;
        }
        return false;
    }
});

<EditText 
            android:id="@+id/et_PatientID"
            android:inputType="text"
            android:layout_width="400dip"
            android:layout_height="50dip"
            android:layout_toRightOf="@id/tv_patientID"
            android:background="@android:drawable/editbox_background"
            android:imeOptions="actionSearch" 
            android:imeActionLabel="Search"  />
K_Anas
  • 31,226
  • 9
  • 68
  • 81