Android 开发随记

隐藏键盘               

((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(WidgetSearchActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); 

 

显示软键盘,控件ID可以是EditText,TextView

((InputMethodManager)getSystemService( INPUT_METHOD_SERVICE)).showSoftInput(mEditPoi , 0);

 

控件获得焦点

mEditPoi.requestFocus();

mEditPoi.setFocusableInTouchMode( true);

 

ScrollView 跳转到特定位置

final int top = mView.mPreviousHistoryGrouping.getTop();

mScrollView.post(new Runnable() {
@Override
public void run() {
  mScrollView.scrollTo(0, top);
  }
});

posted @ 2012-04-19 14:12  骨头  阅读(205)  评论(0编辑  收藏  举报