`
码农笔记
  • 浏览: 2837 次
文章分类
社区版块
存档分类
最新评论

分享:EditText默认不弹出软件键盘

 
阅读更多
方法一:
在AndroidMainfest.xml中选择哪个activity,设置windowSoftInputMode属性为adjustUnspecified|stateHidden
例如:
<activityandroid:name=".Main"android:label="@string/app_name"android:windowSoftInputMode="adjustUnspecified|stateHidden"android:configChanges="orientation|keyboardHidden"><intent-filter><actionandroid:name="android.intent.action.MAIN"/><categoryandroid:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

方法二:
让EditText失去焦点,使用EditText的clearFocus方法
例如:
EditText edit=(EditText)findViewById(R.id.edit); edit.clearFocus();

方法三:
强制隐藏Android输入法窗口
例如:
EditTextedit=(EditText)findViewById(R.id.edit); InputMethodManagerimm= (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);imm.hideSoftInputFromWindow(edit.getWindowToken(),0);
2.EditText始终不弹出软件键盘
例:
EditText edit=(EditText)findViewById(R.id.edit); edit.setInputType(InputType.TYPE_NULL);

以上。另外对APP进行在线全方位的安全性、兼容性测试,我都会用这个:http://www.ineice.com
0
0
分享到:
评论

相关推荐

    Android EditText默认不弹出输入法的实现方法

    一、Android EditText默认不弹出输入法的办法: 1. 在AndroidManifest.xml中将需要默认隐藏键盘的Activity中添加属性即可(常用此方法) android:windowSoftInputMode=adjustUnspecified|stateHidden android:...

    Android 设置Edittext获取焦点并弹出软键盘

    本文主要介绍了Android设置Edittext获取焦点并弹出软键盘的实现代码。具有很好的参考价值。下面跟着小编一起来看下吧

    Android Edittext 不弹出默认的输入框

    当我们采用自定义键盘时候,我们点击Edittext是不想调用系统的输入框的,这个时候我们就需要隐藏掉系统的输入框。demo中就实现了这种需求,很简单的 就是几句代码。

    Android开发EditText属性.txt

    此处无效果,需要弹出输入法才能看得到,参见EditView此属性说明。  android:cursorVisible设定光标为显示/隐藏,默认显示。  android:digits设置允许输入哪些字符。如“1234567890.+-*/% ()”  android:...

    EasyKeyBoardView-master.rar

    * 禁止Edittext弹出软件盘,光标依然正常显示,并且能正常选取光标 */ public static void disableShowSoftInput(EditText editText) { Class&lt;EditText&gt; cls = EditText.class; Method method; try { method = ...

    详细介绍Android中的视图焦点Focus的使用

    而在触摸设备上通常默认情况下只有EditText控件才具有焦点,而我们通常会遇到的一个问题就是当进入一个具有EditText的界面时键盘就会自动弹出,而且有时候可能无法消失,但需求可能是进入时不弹出键盘。而这些所有的...

    Google Android SDK开发范例大全(第3版) 1/5

    4.26 离开与关闭程序的弹出窗口 4.27 隐藏式抽屉 4.28 手机桌面上的小玩意 4.29 手机图片搜索管理器 4.30 实时配置桌面上的AppWidget UI Layout 4.31 识别输入装置ID与InputDevice装置 4.32 选取文字的聪明文字联想 ...

    Google Android SDK开发范例大全(第3版) 4/5

    4.26 离开与关闭程序的弹出窗口 4.27 隐藏式抽屉 4.28 手机桌面上的小玩意 4.29 手机图片搜索管理器 4.30 实时配置桌面上的AppWidget UI Layout 4.31 识别输入装置ID与InputDevice装置 4.32 选取文字的聪明文字联想 ...

    Google Android SDK开发范例大全(第3版) 3/5

    4.26 离开与关闭程序的弹出窗口 4.27 隐藏式抽屉 4.28 手机桌面上的小玩意 4.29 手机图片搜索管理器 4.30 实时配置桌面上的AppWidget UI Layout 4.31 识别输入装置ID与InputDevice装置 4.32 选取文字的聪明文字联想 ...

    Google Android SDK开发范例大全(第3版) 5/5

    4.26 离开与关闭程序的弹出窗口 4.27 隐藏式抽屉 4.28 手机桌面上的小玩意 4.29 手机图片搜索管理器 4.30 实时配置桌面上的AppWidget UI Layout 4.31 识别输入装置ID与InputDevice装置 4.32 选取文字的聪明文字联想 ...

    《Google Android SDK开发范例大全(第3版)》.pdf

    4.26 离开与关闭程序的弹出窗口 149 4.27 隐藏式抽屉 151 4.28 手机桌面上的小玩意 155 4.29 手机图片搜索管理器 158 4.30 实时配置桌面上的appwidget ui layout 163 4.31 识别输入装置id与input...

    Google Android SDK开发范例大全(第3版)part2

     4.26 离开与关闭程序的弹出窗口  4.27 隐藏式抽屉  4.28 手机桌面上的小玩意  4.29 手机图片搜索管理器  4.30 实时配置桌面上的AppWidget UI Layout  4.31 识别输入装置ID与InputDevice装置  4.32 ...

Global site tag (gtag.js) - Google Analytics