android 开发中进入一个activity界面软键盘自动弹出解决(布局中有edittext)

本文介绍了在Android开发中遇到的一个常见问题:当Activity启动时,由于EditText获取焦点,导致软键盘自动弹出。通过在父布局中添加特定代码,可以有效地解决这个问题,避免在多层嵌套布局中使用ScrollView导致的无效情况。
摘要由CSDN通过智能技术生成

其实就是EditText 焦点问题

下面我们就来解决这个问题,开发中为了快,我当时布局中有多个EditText,就在父布局中添加两行代码搞定如下:

android:focusable="true"
android:focusableInTouchMode="true"
直接上代码展示:
比如说布局这样写
<LinearLayout
    android:focusable="true"
    android:focusableInTouchMode="true"
  android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="店铺名称 :"
android:textColor="#1d1d1d"
android:textSize="
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值