zoukankan      html  css  js  c++  java
  • android editText 软键盘enter键图标的设置

    软件盘的界面替换只有一个属性android:imeOptions,

    EditText通过设置android:imeOptions来改变默认的”文本或者样式。这里举几个常用的常量值:

    actionUnspecified  未指定,对应常量EditorInfo.IME_ACTION_UNSPECIFIED.

    actionNone 没有动作,对应常量EditorInfo.IME_ACTION_NONE 

    actionGo 去往,对应常量EditorInfo.IME_ACTION_GO

    actionSearch 搜索,对应常量EditorInfo.IME_ACTION_SEARCH    

    actionSend 发送,对应常量EditorInfo.IME_ACTION_SEND   

    actionNext 下一个,对应常量EditorInfo.IME_ACTION_NEXT   

    actionDone 完成,对应常量EditorInfo.IME_ACTION_DONE  

    <EditText
                            android:id="@+id/msg_edit"
                            android:layout_width="fill_parent"
                            android:layout_height="32dp"
                            android:layout_centerVertical="true"
                            android:layout_toLeftOf="@id/send_msg"
                            android:background="@drawable/send_voice_bg"
                            android:singleLine="true"
                            android:paddingLeft="8dp"
                            android:imeOptions="actionSend"
                            android:textSize="18sp" />

    然后需要重写监听事件,完成想要的功能:

    sendMsgEidt.setOnEditorActionListener(new OnEditorActionListener() {
                
                @Override
                public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                    if (actionId == EditorInfo.IME_ACTION_SEND) {
                        // TODO 
                    }
                    return false;
                }
            });
  • 相关阅读:
    数量关系
    笨办法学python问题记录
    CSS布局与定位
    python学习 预备篇
    基于hexo搭建个人博客
    CSS常用样式
    计算机组成原理(期末篇)
    Codeblock错误提示栏隐藏
    Markdown标记语言
    笨办法学python(不同版本的python代码差别)
  • 原文地址:https://www.cnblogs.com/chenlong-50954265/p/5130637.html
Copyright © 2011-2022 走看看