2011-08-23 96 views

回答

12

尝试 myEditText.setImeActionLabel("Search",EditorInfo.IME_ACTION_UNSPECIFIED)IME_ACTION_UNSPECIFIED可以让你把任何你想要的文字放在按钮中。

+0

静止影像越来越放大镜.. plz帮助我 – Nemo

+0

尝试使用EditorInfo.IME_ACTION_UNSPECIFIED作为动作 – NSjonas

16

像这样

android:imeOptions="actionSearch" 

可能会奏效。你的情况

也有像

android:imeActionLabel="Search" 

编辑其他选项

请这个线程也。 LINK

根据以上链接,您只能在横向模式下获取全文。当IME具有大量的空间

完整的标签仅显示它 (例如,当标准的键盘处于全屏模式)。

,所以我想你可以使用android:imeOptions="actionSearch"和文本Search将仅出现在景观。

+0

喜SAM,还是即时得到放大镜对上述.. PLZ建议我在哪里,我去错了 – Nemo

+0

您使用了* * android:imeActionLabel =“搜索”** – Samuel

+0

你能告诉我你在横向模式下看到什么吗?并且我在更新中添加了一个新链接。 – Samuel

4

试试这个:

<EditText 
    android:id="@+id/editTextSearch" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:ems="10" 
    android:imeOptions="actionSearch" 
    android:singleLine="true" > 
</EditText> 

添加 “机器人:单线” 才能正常工作

0

添加以下两个线路在的EditText标签:

android:inputType="text" 
android:imeOptions="actionSearch" 

,并添加setOnEditorActionListener ()方法editText如下:

etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() { 
      public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { 
       if(actionId == EditorInfo.IME_ACTION_SEARCH){ 
        doSearch(); //Do whatever you intend to do when user click on search button in keyboard. 
        } 

        return true; 
       } 
       return false; 
      } 
     }); 
相关问题