我的思路:使用ScrollView将中间的主体内容包住,再把ScrollView的滚动条去掉。
效果和布局代码如下:
注:我目前测试的,只有Android4.4的机器上下面的布局还是不能上移,不知道原因希望共同探讨。
更新答案:4.4的bug解决,说起来也是自己作死为了适配4.4 的状态栏颜色,特意在stylev19中加了一行:true
就是这一行代码导致4.4上无效,目前原因不明。
提醒下,最好还是在清单文件中 加上
android:windowSoftInputMode="adjustResize"
我为了下面的『下一步』按钮能够永远显示在底部,用一个linearlayout 的android:layout_weight=1做了一个嵌套。
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="vertical"
tools:context="com.luckingus.sns.ui.account.InviteActivity">