Android设计画面中有EditText时取消启动时自动获得焦点调用系统输入法的方法

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
>

在设计画面的XML最底层元素上加上最后两句,让整个Layout获得焦点,这样在打开时EditText就不会自动调用系统输入法了

如果以上不能单纯的解决失去焦点的问题,可在java代码中Create方法里给第一个EditText控件调用clearFocus()方法

这样在第一个控件失去焦点时,焦点不会移到下一个EditText,而是直接交给父容器。

上一篇:【hadoop】——window下elicpse连接hadoop集群基础超详细版


下一篇:java基础回顾(七)——ThreadPoolExecutor