先看下如何自动弹出软键盘:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="#F0F2F5"android:orientation="vertical"><include layout="@layout/common_title_view" /><!--下面两个属性禁止editText自动弹出键盘--><LinearLayoutstyle="@style/ll_common_layout_style"android:focusable="true"android:focusableInTouchMode="true"><TextViewstyle="@style/tv_common_collage_show_style"android:text="商品名称" /><EditTextstyle="@style/et_collage_input_style"android:hint="请输入商品名称" /></LinearLayout><LinearLayout style="@style/ll_common_layout_style"><TextViewstyle="@style/tv_common_collage_show_style"android:text="截止时间" /><EditTextstyle="@style/et_collage_input_style"android:drawableRight="@mipmap/ic_more"android:hint="请选择截止时间"android:paddingRight="@dimen/dp_10" /></LinearLayout><LinearLayout style="@style/ll_common_layout_style"><TextViewstyle="@style/tv_common_collage_show_style"android:text="商品单价" /><EditTextstyle="@style/et_collage_input_style"android:hint="¥ 请输入商品单价" /></LinearLayout><LinearLayout style="@style/ll_common_layout_style"><TextViewstyle="@style/tv_common_collage_show_style"android:text="卖家输入地址" /><EditTextstyle="@style/et_collage_input_style"android:hint="请输入地址" /></LinearLayout><LinearLayout style="@style/ll_common_layout_style"><TextViewstyle="@style/tv_common_collage_show_style"android:text="设置自提地址" /><EditTextstyle="@style/et_collage_input_style"android:hint="请输入地址" /></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="@dimen/dp_42"android:background="@drawable/add_shop_shape_bg"android:gravity="center"><TextViewandroid:layout_width="wrap_content"android:layout_height="match_parent"android:drawableLeft="@mipmap/addsm"android:drawablePadding="@dimen/dp_9"android:gravity="center"android:text="添加新商品" /></LinearLayout><LinearLayout style="@style/ll_common_layout_style"><TextViewstyle="@style/tv_common_collage_show_style"android:text="0人成团" /><TextViewstyle="@style/addAndDelete"android:text="—" /><TextViewstyle="@style/addAndDelete"android:layout_marginLeft="-1dp"android:layout_marginRight="@dimen/dp_10"android:background="@drawable/collage_add_shape"android:text="+" /></LinearLayout><LinearLayout style="@style/ll_common_layout_style"><TextViewstyle="@style/tv_common_collage_show_style"android:text="0件成团" /><TextViewstyle="@style/addAndDelete"android:text="—" /><TextViewstyle="@style/addAndDelete"android:layout_marginLeft="-1dp"android:layout_marginRight="@dimen/dp_10"android:background="@drawable/collage_add_shape"android:text="+" /></LinearLayout><LinearLayout style="@style/ll_common_layout_style"><TextViewstyle="@style/tv_common_collage_show_style"android:text="每人每单最多" /><TextViewstyle="@style/et_collage_input_style"android:layout_marginRight="@dimen/dp_10"android:drawablePadding="@dimen/dp_5"android:drawableRight="@mipmap/ic_more"android:gravity="right"android:text="99件"android:textColor="@color/black" /></LinearLayout><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginBottom="@dimen/dp_5"android:layout_marginLeft="@dimen/dp_15"android:layout_marginTop="@dimen/dp_5"android:text="添加图片(1件商品1张图片,按顺序上传)"android:textColor="#999999" /><RelativeLayoutandroid:id="@+id/ll_add_image"android:layout_width="@dimen/dp_106"android:layout_height="@dimen/dp_85"android:layout_marginBottom="@dimen/dp_5"android:layout_marginTop="@dimen/dp_5"><ImageViewandroid:id="@+id/iv_set_image"android:layout_width="@dimen/dp_99"android:layout_height="@dimen/dp_78"android:layout_marginRight="@dimen/dp_7"android:layout_marginTop="@dimen/dp_7"android:src="@mipmap/add_image" /><ImageViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:src="@mipmap/delete" /></RelativeLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="@dimen/dp_1"android:background="@color/white"android:orientation="vertical"><TextViewandroid:layout_width="wrap_content"android:layout_height="@dimen/dp_42"android:gravity="center"android:paddingLeft="@dimen/dp_15"android:text="商品介绍"android:textColor="@color/black"android:textSize="14sp" /><Viewandroid:layout_width="match_parent"android:layout_height="@dimen/dp_1"android:background="#F0F2F5" /><EditTextandroid:layout_width="match_parent"android:layout_height="@dimen/dp_84"android:background="@android:color/transparent"android:hint="请输入商品介绍"android:paddingBottom="@dimen/dp_15"android:paddingLeft="@dimen/dp_15"android:textColor="#333333"android:textSize="14sp" /></LinearLayout><LinearLayout style="@style/ll_common_layout_style"><TextViewstyle="@style/tv_common_collage_show_style"android:text="售后电话"android:textColor="@color/black" /><EditTextstyle="@style/et_collage_input_style"android:hint="请输入售后电话" /></LinearLayout></LinearLayout></ScrollView>

如上代码:在EditText布局的父类布局的xml中设置如下即可:

 android:focusable="true"android:focusableInTouchMode="true"

就可以解决了

我们看下添加属性后的效果:

感谢博主:原博主链接

Android开发之EditText自动获取焦点自动弹出软键盘的解决办法相关推荐

  1. android+点击屏幕隐藏键盘,Android点击EditText文本框之外任何地方隐藏键盘的解决办法...

    1,实现方法一: 通过给当前界面布局文件的父layout设置点击事件(相当于给整个Activity设置点击事件),在事件里进行键盘隐藏 android:id="@+id/traceroute ...

  2. Android中的EditText默认时不弹出软键盘的方法

    在做项目过程中 , 父 Activity 中 用 ViewPager 中 的子 ActivityEditText默认弹出软键盘.这是想屏蔽 软键盘 应该从父 Activity 中处理.处理子 Acti ...

  3. Android点击EditText文本框之外任何地方隐藏键盘的解决办法

    通过给当前界面布局文件的父layout设置点击事件(相当于给整个Activity设置点击事件),在事件里进行键盘隐藏 <LinearLayout xmlns:android="http ...

  4. EditText获取焦点并自动弹出软键盘

    项目中用到了评论功能,我想实现的效果就是点击了评论图片之后自动获取焦点并弹出软键盘让用户输入. 实现代码如下--

  5. Android开发之EditText属性详解+++ImageView的属性

    Button的使用 不要阴影Button ---> TextView   (5.0新特性) <!-- 去按钮立体效果 --> <item name="android: ...

  6. 按回车Enter键后自动隐藏软键盘、进页面自动弹出软键盘

    在布局文件中EditText控件中加入属性: android:imeOptions="actionDone"         imeOptions还有很多其他参数,比如搜索,前往. ...

  7. android 页面默认不弹软键盘_Android避免进入页面自动弹出软键盘(真正好用)

    有的时候当我们进入一个有 EditText控件的界面时,会自动弹出软键盘,有的时候会给我们带来不便,有人说可以让EditText不获得焦点,虽然同样可以实现,但是我们有以下两个个更好的方式去实现这个效 ...

  8. Windows自动弹出MSN中文网界面解决办法

    Windows自动弹出MSN中文网界面解决办法 原因:每当用户连接到网络时,Windows 会向微软的一个域名发送访问请求,访问结果作为网络连接状况指示器(Network Connectivity S ...

  9. Android自动弹出软键盘(输入键盘)

    Android输入框自动弹出键盘显示和关闭 1.软键盘的自动弹出 /*** 显示键盘** @param et 输入焦点*/ public void showInput(final EditText e ...

最新文章

  1. 多组学-ATAC-seq-概念
  2. 「中间件系列一」kafka消息中间件
  3. java ee的小程序_扩展Java EE应用程序的基础
  4. 如何在MyEclipse上耍Chrome
  5. 自动驾驶的Pipline -- 如何打造自动驾驶的数据闭环?(中)
  6. matlab 保存变量
  7. linux下ftp命令打印日志,ftp服务器日志解析
  8. juki贴片机是什么牌子,juki贴片机型号一览表
  9. 编程语言学习方法总结
  10. 计算机word保存如何操作,电脑word怎么保存 在电脑上word打字怎么保存
  11. 前端微信一键登录和微信小程序支付总结
  12. dnf最新地图编号2020_dnf2020搬砖地图排行榜 dnf2020最佳搬砖地图
  13. BIOS内部模块详解
  14. android 通知历史,如何查看已随指尖划走的那些通知 -- Past Notifications #Android
  15. Mac 如何使用外部存储设备,移动硬盘备份 iPhone 数据
  16. Tomcat项目部署方式
  17. fluent python 2nd edition_Fluent Python: Slice
  18. 《深入浅出SQL》问答录
  19. 自上而下语法分析(LL1文法例题)
  20. python-Computing with Strings课后题

热门文章

  1. HDLBits答案(2)_Verilog向量基础
  2. vivadoRAM中初始化文件coe如何快速生成
  3. 计算机网络和传统电话网络的最大区别是,传统电话和网络电话有什么区别
  4. ttc error oracle,ORA-03137: TTC protocol internal error : [12333]错误一例
  5. 中职高级计算机操作员,计算机操作员专业排行榜
  6. java三点确定圆弧_圆弧方向判断方法和三点确定一个圆的计算方法
  7. xp系统web服务器搭建教程,Windows_XP配置WEB服务器教程(图)
  8. Vue项目中v-for无法渲染数据
  9. 初识python 2.x与3.x 区别
  10. 数学:莫比乌斯反演-约数个数和