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

摘抄代码没测试 发启程序的返回顺序以及恩enter建取消输入法

2012-09-28 
摘抄代码没测试 发起程序的返回顺序以及恩enter建取消输入法1.activity ... android:launchModesingleT

摘抄代码没测试 发起程序的返回顺序以及恩enter建取消输入法

1.<activity ... android:launchMode="singleTop" />?
Intent intent= new Intent(context, YourActivity.class);?
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);?

?

2.yourEditTextHere.setOnEditorActionListener(new OnEditorActionListener() {?
?
? ? ? ? @Override?
? ? ? ? public boolean onEditorAction(TextView v, int actionId,?
? ? ? ? ? ? ? ? KeyEvent event) {?
? ? ? ? ? ? if (event != null&& (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {?
? ? ? ? ? ? ? ? InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);?
? ? ? ? ? ? ? ? in.hideSoftInputFromWindow(searchBar?
? ? ? ? ? ? ? ? ? ? ? ? .getApplicationWindowToken(),?
? ? ? ? ? ? ? ? ? ? ? ? InputMethodManager.HIDE_NOT_ALWAYS);?
? ? ? ? ? ? ? ?userValidateEntry();?
? ? ? ? ? ? }?
? ? ? ? ? ? return false;?
? ? ? ? }?
? ? });?
这个我测试没有看出啥效果

?

?

?

热点排行