【问题标题】:change the return key更改返回键
【发布时间】:2012-07-01 16:13:04
【问题描述】:

我想将输入按钮(图中圈出的按钮)的名称更改为搜索

所以我用了

  <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" />

但是没用

【问题讨论】:

  • 尝试添加 android:inputType="text",查看更新答案

标签: android android-keypad


【解决方案1】:

android:imeOptions="actionSearch"android:inputType="text" 添加到您的 EditText 视图

同时添加编辑器动作监听器

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"  />

【讨论】:

  • @AMH remove imeOptions="acionUnspecified"
  • @AMH 你用的是哪个安卓版本
  • 我使用的是 android 2.2 ,我正在开发以针对它和更高版本
  • 非常感谢,我想我需要清理项目对不起
  • @AMH 我认为这行不通,你可以试试并告诉我:D,对不起,我面前没有日食
猜你喜欢
  • 1970-01-01
  • 2015-05-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-09
  • 2013-08-16
相关资源
最近更新 更多