android点击EditText软键盘不弹出的问题

今天踩了一个坑,坑是这样的,一个for循环,然后inflate一个布局,把这个布局动态的添加到一个linearlayout,布局代码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:gravity="center_vertical"
    android:background="@color/white"
    >


    <android.support.v7.widget.AppCompatEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:maxLength="50"
        android:layout_marginTop="8dip"
        android:layout_marginBottom="8dip"
        android:layout_marginLeft="16dip"
        android:paddingLeft="6dip"
        android:textColor="@color/app_main_black_text"
        android:singleLine="true" />

    <android.support.v7.widget.AppCompatRadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/vote_ver"
        android:layout_marginRight="16dip"
        android:visibility="visible"
        android:gravity="center"

        >
    </android.support.v7.widget.AppCompatRadioButton>

    <android.support.v7.widget.AppCompatCheckBox
        android:layout_width="26dip"
        android:layout_height="26dip"
        android:layout_marginLeft="@dimen/vote_ver"
        android:layout_marginRight="16dip"
        android:visibility="gone" />

</LinearLayout>

里面有一个EditText,然后运行时候坑就出现了,无论怎么点击这个EditText,光标的显示一闪而过,软键盘也根本不会弹出来,为EditText添加了onFoucseChangeListener,根本不执行。。。然后我新建了一个DEMO,把这部分代码单独提取处来,写了个demo跑了一下,居然能正常运行,点击EditText也能弹出软键盘,,,,实在是又气又恼啊,不知道哪里出了问题,最后的解决方法是:

把EditText的        android:background="@drawable/et_search_ll_bg"这个属性去掉运行就好了,。点击EditText就能弹出软键盘,,你说这个问题奇不奇葩,都不知道这个问题怎么产生的。。上面的xml布局是能正常运行出来的布局界面



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黄油奥特曼

如果可以,请我喝一杯咖啡

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值