大佬教程收集整理的这篇文章主要介绍了为什么在添加ListView时会弹出Android键盘,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的布局包含2个EditText,当我启动活动时,键盘不会自动弹出.但是当我在布局中的任何位置添加ListView时,键盘会在活动开始时弹出.
我知道有很多方法可以像这样隐藏键盘:getWindow().setSofTinputMode(WindowManager.LayoutParams.soFT_INPUT_STATE_HIDDEN)你可能已经看到了其他问题,如here和here,但我的问题不是如何防止这个但是为什么会这样?
<LinearLayout xmlns:android="http://scheR_957_11845@as.android.com/apk/res/android" xmlns:tools="http://scheR_957_11845@as.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:BACkground="@android:color/black" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="chadi.projects.code.TestKeyboardActivity" > <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:BACkground="@android:color/white" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:BACkground="@android:color/white" /> <ListView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="20dp" /> </LinearLayout>
如果此ListView不存在,则键盘不会显示.如果我用其他视图替换ListView,它仍然不会显示.只有当我添加一个简单的ListView(甚至没有任何东西填充它)时,keboard才会显示出来.
为什么会这样?
以上是大佬教程为你收集整理的为什么在添加ListView时会弹出Android键盘全部内容,希望文章能够帮你解决为什么在添加ListView时会弹出Android键盘所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。