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;
                }
            });
  • 相关阅读:
    html Table实现表头固定
    Asp.net ORA-12154: TNS: 无法解析指定的连接标识符
    VS加载项目时报错 尚未配置为Web项目XXXX指定的本地IIS
    Sqlserver 导出insert插入语句
    RRAS
    MVC实例应用模式
    MVC概述
    23种设计模式
    XXX系统质量属性
    大型网站架构读后感
  • 原文地址:https://www.cnblogs.com/chenlong-50954265/p/5130637.html
Copyright © 2011-2022 走看看