android EditText imeOptions属性和各属性setOnEditorActionListener
16lz
2021-12-04
点击输入框时,弹出软键盘,细心的会发现软件上面右下角的按钮,有时会有不同:
这样就关系到EditText的属性:imeOptions
设置 android:imeOptions=”actionDone” ,软键盘下方变成“完成;
android:imeOptions=”actionSend” 软键盘下方变成“发送”
android:imeOptions=”actionSearch” 软键盘下方变成“搜索“等属性
edittext.setOnEditorActionListener(this);为edittext这个属性按钮的监听事件
@Overridepublic boolean onEditorAction(TextView v, int actionId, KeyEvent event) { switch (actionId) { case EditorInfo.IME_ACTION_SEND://你点了软键盘'发送'按钮" break;
case EditorInfo.IME_ACTION_GO://你点了软键盘'去往'按钮" break;
case EditorInfo.IME_ACTION_SEARCH://你点了软键盘'搜索'按钮" break;
case EditorInfo.IME_ACTION_DONE://你点了软键盘'完成'按钮" break;} return false;}
更多相关文章
- android:contentDescription 的用途
- android:fitsSystemWindows
- android 在EditText内嵌入图片资源
- Android(安卓)启动 白屏问题 解决
- TextView——文本省略显示
- Android(安卓)界面的基本属性
- Android抽象布局——include、merge 、ViewStub
- android 按钮设计中state_selected属性
- 在Android中自定义IOS风格的按钮