Android 开发小零碎

1.EditText默认就会自动获取焦点, 如何让EditText不自动获取焦点?

解决之道:在EditText的父级控件中找一个,设置成

android:focusable="true"
android:focusableInTouchMode="true"

 2.Android如何让软键盘出现和消失

InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);     

imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN);  

imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); 

 

 
posted on 2017-08-21 10:35  助金  阅读(134)  评论(0编辑  收藏  举报