如何给EditText定焦点隐藏软盘限制字符个数

xiaoxiao2021-02-28  119

//定焦点定焦点到字符串最后面 CharSequence query = et_loc_qhis_query.getText(); if (query instanceof Spannable) { Spannable spanText = (Spannable)query; Selection.setSelection(spanText, query.length()); } //搜索时隐藏键盘 InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(et_loc_qhis_query.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); //限制字符个数 android:maxLength="16" 或 editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(10)});
转载请注明原文地址: https://www.6miu.com/read-81171.html

最新回复(0)