在android开发中,关于EditText自动获取焦点弹出键盘,我们可能又是会有让键盘自动弹出的需求,有时可能又会有不想让键盘自动弹出的需求,下面是我所总结的两种方法: 需求:EditText自动获取焦点并弹出键盘,代码:   EditText.setFocusable(true);   EditText.setFocusableInTouchMode(true);   EditText.requestFocus(); 需求:EditText不会自动获取焦点并且不会弹出键盘,代码:  将其父控…
1.EditText不自动获取焦点并且不会弹出键盘 找到EditText的父控件,设置其父控件为: Parent.setFocusable(true); Parent.setFocusableInTouchMode(true); 2. 调用指定方法令 EditText自动获取焦点并弹出键盘 private void showInputTips(EditText et_text) { et_text.setFocusable(true); et_text.setFocusableInTouchMo…
android自动弹出软键盘(输入键盘) 在AndroidMainfest.xml内容无法更改情况下,也就是键盘非要弹出情况下,进入此页面时先关闭软键盘不让其弹出 InputMethodManager imm = (InputMethodManager)passwordText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(passwordText.getWindo…
解决方法: 在EditText的父级控件中找一个,设置成 android:focusable="true" android:focusableInTouchMode="true" EditText的默认行为取消了 <LinearLayout android:id="@+id/top_search" android:layout_width="fill_parent" android:layout_height="…
场景 效果 注: 博客: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程序猿 获取编程相关电子书.教程推送与免费下载. 实现 将布局改为LinearLayout,并通过android:orientation="vertical">设置为垂直布局. 然后添加一个ImageView,并设置id属性和图片源. <?xml version="1.0" encoding="utf-8"?…
1.自定义style 2.使用方法: buttonWhat.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Dialog dialog = new Dialog(activate.this, R.style.ShakeDialog); // Setting the title and layout for th…
iPhone/iPad和Android提供不同的的键盘输入类型,触发合适的键盘将极大地改善用户体验.   键盘类型 默认: 默认键盘的字母模式 数字: 默认键盘的数字模式,(含小数点等) 邮件: 与默认基本相同,含'@'等邮件字符 网站: 同样,含一些网址字符 电话: 纯数字键盘   使用一些Html5触发键盘 默认类型为text <input type="text"> 邮箱和网址为 <input type="email"><input…
windowSoftInputMode属性设置值 2012-08-30 16:49 1592人阅读 评论(0) 收藏 举报 androidattributes活动 (1).AndroidManifest.xml文件中界面对应的<activity>里加入            android:windowSoftInputMode="adjustPan"   键盘就会覆盖屏幕            android:windowSoftInputMode="state…
转自http://www.cnblogs.com/yejiurui/archive/2013/01/02/2841945.html 在我们的应用中,有时候一进入一个页面, EditText默认就会自动获取焦点.弹出输入法框,用户体验很不好, 那么如何取消这个默认行为呢? ps:这篇文字是一年前写的,现在有网友再问这个问题,我进行重新编辑--2014.05.07,目前有更好的办法,第一种方法局限性很强,大家可以使用第二种方法 第一种方法:.在网上找了好久,有点监听软键盘事件的方法,有调用 clea…
android在进入一个新页面后,edittext会自动获取焦点并弹出软键盘,这样并不符合用户操作习惯. 在其父控件下,添加如下的属性,就可以完美解决,使其进入页面后不主动获取焦点,并且不弹出软键盘: android:focusable="true"   android:focusableInTouchMode="true" 代码如下: <ScrollView android:layout_width="match_parent" andr…