开场白:经常在耳边听到测试或者产品说:“为什么ios可以实现,Android不可以了?”
需求:模仿微信创建拼手气红包的页面。
解决方案:

首先在需要软键盘顶上去的布局外面嵌套ScrollView

   <ScrollView        android:id="@+id/scrollview"        android:layout_width="match_parent"        android:layout_height="wrap_content">        <LinearLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:fitsSystemWindows="true"            android:orientation="vertical">            ....这里是需要软键盘顶上去的布局        LinearLayout>    ScrollView>

然后onCreate中`

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

最后监听EditText的点击事件

        editText.setOnTouchListener(new View.OnTouchListener() {            @Override            public boolean onTouch(View view, MotionEvent motionEvent) {                mHandler.post(...这里设置滚动到底部... scrollview.fullScroll(ScrollView.FOCUS_DOWN));                return false;            }        });

注:
scrollView.fullScroll(ScrollView.FOCUS_DOWN);滚动到底部

更多相关文章

  1. Android 弹出键盘往上挤压页面
  2. [图文]为移植到Android平台上的Cocos2d-x项目添加xml布局文件
  3. Android Notes|细数「八大布局」那些事儿
  4. Android 和 iPhone 界面布局示例
  5. Android学习笔记2之基于XML的布局
  6. Android常用布局(FrameLayout、LinearLayout、RelativeLayout)详解
  7. Android app性能优化解决卡慢顿之布局优化

随机推荐

  1. [转]android studio 提示 Error:Failed t
  2. android 网络状态判断
  3. Android(安卓)hdpi、nodpi、sw600dp-xhdp
  4. Android studio 53 文件下载
  5. More about keeping Android’s screen a
  6. Android之富有动感的底部弹窗效果
  7. Android Bander设计与实现 - 设计篇
  8. Android Messenger 进程间通信
  9. Android(安卓)选择图片与视频
  10. android java.util.ConcurrentModificati