首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android 输入法的运用

2012-06-30 
android 输入法的使用@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(sav

android 输入法的使用

@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.softkey);buttonshow = (Button)findViewById(R.id.buttonshow);editshow = (EditText)findViewById(R.id.editshow);buttonshow.setOnClickListener(this);editshow.setOnClickListener(this);}/** *  *  *  *  * 输入法的使用 */@Overridepublic void onClick(View v) {switch (v.getId()) {case R.id.buttonshow:showKeyboard();break;case R.id.editshow:showKeyboard();break;default: break; }}private void showKeyboard() {InputMethodManager m=(InputMethodManager) (this.getBaseContext().getSystemService(INPUT_METHOD_SERVICE));m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);//m.hideSoftInputFromWindow(this.getWindow().getWindowStyle().get, 0);}}
?

热点排行