imeOptions 属性详解
默认情况下软键盘右下角的按钮为“下一个”,点击会到下一个输入框,保持软键盘

设置 android:imeOptions="actionDone" ,软键盘下方变成“完成”,点击后光标保持在原来的输入框上,并且软键盘关闭


- package com.test;
- import com.test.main.TestAsyn;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.KeyEvent;
- import android.view.inputmethod.EditorInfo;
- import android.widget.EditText;
- import android.widget.TextView;
- import android.widget.TextView.OnEditorActionListener;
- import android.widget.Toast;
- public class IMFActivity extends Activity implements OnEditorActionListener {
- EditText etDefault;
- EditText etEmail;
- EditText etNumber;
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.imf_layout);
- etDefault = (EditText)findViewById(R.id.default_content);
- etEmail = (EditText)findViewById(R.id.email_content);
- etNumber = (EditText)findViewById(R.id.number_content);
- etDefault.setOnEditorActionListener(this);
- etEmail.setOnEditorActionListener(this);
- etNumber.setOnEditorActionListener(this);
- }
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- switch(actionId){
- case EditorInfo.IME_NULL:
- System.out.println("null for default_content: " + v.getText() );
- break;
- case EditorInfo.IME_ACTION_SEND:
- System.out.println("action send for email_content: " + v.getText());
- break;
- case EditorInfo.IME_ACTION_DONE:
- System.out.println("action done for number_content: " + v.getText());
- break;
- }
- //Toast.makeText(this, v.getText()+"--" + actionId, Toast.LENGTH_LONG).show();
- return true;
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent" android:layout_height="fill_parent">
- <TableLayout android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <TableRow>
- <TextView android:text="No special rules" android:id="@+id/TextView01"
- android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
- <EditText android:text="1111111111111" android:id="@+id/default_content"
- android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
- </TableRow>
- <TableRow>
- <TextView android:text="Email address:" android:id="@+id/TextView01"
- android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
- <EditText android:text="" android:id="@+id/email_content"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:inputType="text|textEmailAddress"
- android:imeOptions="actionSend"></EditText>
- </TableRow>
- <TableRow>
- <TextView android:text="Signed decimal number:" android:id="@+id/TextView01"
- android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
- <EditText android:text="" android:id="@+id/number_content"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:inputType="number|numberSigned|numberDecimal"
- android:imeOptions="actionDone"></EditText>
- </TableRow>
- </TableLayout>
- </ScrollView>
imeOptions 属性详解的更多相关文章
- Android TextView和EditText属性详解
TextView属性详解: autoLink设置 是否当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接.可选值(none/web /email/phone/map/all) ...
- EditText属性详解
关于EditText属性详解很详细的记录,转过来收着 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password=" ...
- Android textAppearance的属性设置及TextView属性详解
textAppearance的属性设置 android:textAppearance="?android:attr/textAppearanceSmall" android:tex ...
- Android笔记-2-TextView的属性详解
[Android 基础]TextView的属性详解 android:autoLink :设置是否当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接.可选值(none/web / ...
- android:exported 属性详解
属性详解 标签: android 2015-06-11 17:47 27940人阅读 评论(7) 收藏 举报 分类: Android(95) 项目点滴(25) 昨天在用360扫描应用漏洞时,扫描结果, ...
- OutputCache属性详解(一)一Duration、VaryByParam
目录 OutputCache概念学习 OutputCache属性详解(一) OutputCache属性详解(二) OutputCache属性详解(三) OutputCache属性详解(四)— SqlD ...
- OutputCache属性详解(二)一 Location
目录 OutputCache概念学习 OutputCache属性详解(一) OutputCache属性详解(二) OutputCache属性详解(三) OutputCache属性详解(四)— SqlD ...
- OutputCache属性详解(三)— VaryByHeader,VaryByCustom
目录 OutputCache概念学习 OutputCache属性详解(一) OutputCache属性详解(二) OutputCache属性详解(三) OutputCache属性详解(四)— SqlD ...
- OutputCache属性详解(四)— SqlDependency
目录 OutputCache概念学习 OutputCache属性详解(一) OutputCache属性详解(二) OutputCache属性详解(三) OutputCache属性详解(四)— SqlD ...
随机推荐
- VC++ 工程添加 Unicode Debug和Unicode Release编译支持
转载:http://blog.csdn.net/djhdu/article/details/171766 转载:http://blog.163.com/long_lh/blog/static/2769 ...
- .Net连接数据库-曾,删,改,查(AOD.Net)
连接数据库 static void Main(string[] args) { //SqlConnection conn = new SqlConnection();//实例化 //conn.Conn ...
- CodeForces 496B Secret Combination
Secret Combination Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u ...
- linux终端下为什么用命令打开软件后,要关闭软件才能继续下一条命令?
用终端打开chromium浏览器(命令:chromium-browser)的时候发现打开浏览器之后无法继续在终端输入命令,只能关闭浏览器或者在终端按下Ctrl+c,此时系统将退出浏览器并可以继续在终端 ...
- Task<TResult>的使用
https://msdn.microsoft.com/en-us/library/dd321424(v=vs.110).aspx Represents an asynchronous operatio ...
- MeshLab中进行点云配准
MeshLab是一个开源.可移植和可扩展的三维几何处理系统,主要用于交互处理和非结构化编辑三维三角形网格.它支持多种文件格式: import:PLY, STL, OFF, OBJ, 3DS, COLL ...
- Get_File_Name Usage in Oracle Forms 6i
Get_File_Name is built-in function of Oracle Forms 6i, used to get the file name with address by bro ...
- poj 1654 Area (多边形求面积)
链接:http://poj.org/problem?id=1654 Area Time Limit: 1000MS Memory Limit: 10000K Total Submissions: ...
- jQuery的.click,.bind,.unbind,.on,.off,.delegate,.undelegate
.click与.bind .click和.bind都是给每个元素绑定事件,对于只绑定一个click事件,.bind事件的简写就是.click那种方式. 这两种方式都会出现两个问题: 第一个问题,如果要 ...
- 64位Eclipse运行时提示“Failed to load the JNI shared library \Java\jre6\bin\client\jvm.dll”的一个解决方案
系统安装的32位JREE,64位eclipse无法识别,解决方案:下载安装64位jdk即可.