方法1:使用KeyWordUtils 使用方法:
ScrollView中包含LinearLayout,改LinearLayout中可放置多个edittext 
activity在配置文件中记得添加 android:windowSoftInputMode=”adjustResize|stateHidden”
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 import  android.annotation.SuppressLint;import  android.app.Activity;import  android.content.Context;import  android.graphics.Rect;import  android.view.View;import  android.view.ViewGroup;import  android.view.WindowManager;import  android.widget.ScrollView;public  class  KeyWordUtils  {     @SuppressLint ("NewApi" )   public  static  void  pullKeywordTop (final  Activity activity,final  int  lyRootID,final  int  vID,final  int  svID,final  int  needHideId)     ViewGroup ly = (ViewGroup) activity.findViewById (lyRootID);          final  int  defaultHeight = ((WindowManager)activity.getSystemService (Context.WINDOW_SERVICE)).getDefaultDisplay ().getHeight ();     final  int  mKeyHeight = defaultHeight/4 ;     ly.addOnLayoutChangeListener (new  View.OnLayoutChangeListener () {       @Override       public  void  onLayoutChange (View v, int  left, int  top, int  right,                    int  bottom, int  oldLeft, int  oldTop, int  oldRight, int  oldBottom) {                  int  height = oldBottom-bottom;         ScrollView sv = (ScrollView)activity.findViewById (svID);        if (height>mKeyHeight) {           activity.findViewById (needHideId).setVisibility (View.GONE);           final  int  lybottom = bottom;           sv.post (new  Runnable () {             @Override             public  void  run () {               ScrollView runSv = (ScrollView)activity.findViewById (svID);                              View v = (View)activity.findViewById (vID);               int [] loca = new  int [2 ];                              v.getLocationOnScreen (loca);                             Rect frame = new  Rect ();                              activity.getWindow ().getDecorView ().getWindowVisibleDisplayFrame (frame);                              int  statusBarHeight = frame.top;                              int  scrollHeight = loca[1 ] + v.getHeight () - lybottom - statusBarHeight;               if (scrollHeight>0 ){                 runSv.scrollBy (0 , scrollHeight);               }             }           });         }else  if (-height>mKeyHeight){           sv.scrollTo (0 ,0 );           activity.findViewById (needHideId).setVisibility (View.VISIBLE);         }       }     });   } } 
方法2: 在activity的底部加一个占位的View,当页面能测量控件高度时,每次键盘弹出后,增加占位View的高度。
findViewById(R.id.ly_login).getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()    {      @Override      public void onGlobalLayout()      {        Rect r = new Rect();//获取当前界面可视部分        OpenCunGuanActivity.this.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);//获取屏幕的高度        int screenHeight = OpenCunGuanActivity.this.getWindow().getDecorView().getRootView().getHeight();//此处就是用来获取键盘的高度的, 在键盘没有弹出的时候 此高度为0键盘弹出的时候为一个正数        int heightDifference = screenHeight - r.bottom;CMLog.i(“info”,”软键盘高度:”+ heightDifference +” 屏幕高度”+ screenHeight +” 可视区域高度:”+ r.bottom+” marginTop”+ marginTop);// 在xml中设置hiddenView的高度,会导致部分界面超过一些低像素高度小的手机,已进入界面就可以滑动        if (r.bottom< screenHeight)        {          originalParams.height= heightDifference + marginTop *3/5;hiddenView.setLayoutParams(originalParams);}        else        {          originalParams.height=0;hiddenView.setLayoutParams(originalParams);mSvContent.scrollTo(0, marginTop);}      }    });
转自:http://m.blog.csdn.net/u012764110/article/details/52223804