scattered_num_et为输入框控件。
方法一:
scattered_num_et.showSoftInputOnFocus = false
方法二:
scattered_num_et.inputType = InputType.TYPE_NULL
方法三:
try {
val cls =
EditText::class.java
val setSoftInputShownOnFocus: Method =
cls.getMethod("setShowSoftInputOnFocus", Boolean::class.javaPrimitiveType)
setSoftInputShownOnFocus.isAccessible = true
setSoftInputShownOnFocus.invoke(scattered_num_et, false)
setSoftInputShownOnFocus.invoke(scattered_num_et2, false)
setSoftInputShownOnFocus.invoke(scattered_num_et3, false)
} catch (e: Exception) {
e.printStackTrace()
}