Fco*_*der 14 java android android-softkeyboard android-edittext
我更改android软键盘以显示搜索图标而不是Enter图标.我的问题是:如何检测用户点击该搜索按钮?
Arp*_*arg 34
在edittext中,您可能已使用输入法选项进行搜索.
<EditText
android:imeOptions="actionSearch"
android:inputType="text"/>
Run Code Online (Sandbox Code Playgroud)
现在使用EditText上的Editor监听器来处理搜索事件,如下所示:
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
// Your piece of code on keyboard search click
return true;
}
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10459 次 |
| 最近记录: |