|
@@ -2,6 +2,8 @@ import android.content.res.Resources
|
2
|
2
|
import android.os.Bundle
|
3
|
3
|
import android.util.Log
|
4
|
4
|
import android.view.Gravity
|
|
5
|
+import android.view.inputmethod.InputMethodManager
|
|
6
|
+import android.widget.EditText
|
5
|
7
|
import androidx.lifecycle.ViewModelProvider
|
6
|
8
|
import androidx.viewbinding.ViewBinding
|
7
|
9
|
import com.hjq.toast.Toaster
|
|
@@ -112,4 +114,14 @@ abstract class BaseActivity<VM : CommonBaseViewModel, VB : ViewBinding> : Common
|
112
|
114
|
super.onDestroy()
|
113
|
115
|
EventBus.getDefault().unregister(this)
|
114
|
116
|
}
|
|
117
|
+
|
|
118
|
+ fun hiddenSoft(editText: EditText){
|
|
119
|
+ try {
|
|
120
|
+ val inputMethodManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
|
121
|
+ // 隐藏输入法键盘
|
|
122
|
+ inputMethodManager.hideSoftInputFromWindow(editText.windowToken, 0)
|
|
123
|
+ }catch (e:Exception){
|
|
124
|
+
|
|
125
|
+ }
|
|
126
|
+ }
|
115
|
127
|
}
|