赞
踩
AndroidStudio
配置
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.facebook.fresco:fresco:0.9.0+'
}
如何实现点击“评论”之后跳出拼音输入法,代码如下:
/** * 显示或隐藏输入法 */ private void onFocusChange(boolean hasFocus) { final boolean isFocus = hasFocus; (new Handler()).postDelayed(new Runnable() { public void run() { InputMethodManager imm = (InputMethodManager) MainActivity.this.getSystemService(INPUT_METHOD_SERVICE); if (isFocus) { //显示输入法 imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); mAmEtMsg.setFocusable(true); mAmEtMsg.requestFocus(); } else { //隐藏输入法 imm.hideSoftInputFromWindow(mAmEtMsg.getWindowToken(), 0); } } }, 100); }
细节不再累述,参看源码
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。