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;
                }
            });
  • 相关阅读:
    洛谷 P1430 序列取数
    洛谷 P2042 维护数列
    洛谷 P3391 【模板】文艺平衡树(Splay)
    Permutation UVA
    treap板子(洛谷 P3369 【模板】普通平衡树(Treap/SBT))
    Jumping Jack CodeForces
    Increasing Sequence CodeForces
    Cunning Gena CodeForces
    Hie with the Pie POJ
    ACboy needs your help HDU
  • 原文地址:https://www.cnblogs.com/chenlong-50954265/p/5130637.html
Copyright © 2011-2022 走看看