软件盘的界面替换只有一个属性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;            }        });

更多相关文章

  1. Android中使用log4j
  2. Android中JNI 的一些常用说明 JNI_OnLoad registerNatives regis
  3. Android使用Asynchronous Http Client完成登录保存cookie的问题
  4. Android(安卓)Lib Project与Android(安卓)Project中R文件的区别
  5. mtk android 背光设置
  6. Android(安卓)Studio配置google protobuf
  7. 自动完成文本框AutoCompleteTextView
  8. Android(安卓)WifiManager 常量
  9. Android(安卓)之 添加按钮添加声音

随机推荐

  1. Android(安卓)X86上运行基于ARM">ARM处理
  2. Android实习生 —— 开发必须知道的事
  3. [Android] 彻底了解Binder机制原理和底层
  4. Android和Django服务器传输json数据
  5. Unity导出android工程集成到android stud
  6. Android(安卓)Multidex导致的App启动缓慢
  7. Android绘图基本用法Demo
  8. Android(安卓)Binder实现浅析-Binder驱动
  9. Android原生(Native)C开发之二 framebuff
  10. Android使用WebView加载文字总结之中文乱