package com.ydl.ydlcommon.utils import android.content.Context import android.view.inputmethod.InputMethodManager import android.widget.EditText /** * 输入法工具类 * Created by harvie on 2017/6/23 0023. */ class InputMethonUtils{ companion object{ /** * EditText获取焦点并显示软键盘 */ fun showSoftInputFromWindow(context : Context,editText: EditText?) { editText?.isFocusable = true editText?.isFocusableInTouchMode = true editText?.requestFocus() var input : InputMethodManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager input.showSoftInput(editText,0) } } }