软键盘弹出后ScrollView设置为滚动
16lz
2021-01-26
对于那些需要填写很多内容的页面,使用ScrollView并滚动就方便了许多,ScrollView:
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:isScrollContainer="true"> </ScrollView>
一种办法是在AndroidManifest.xml设置ACTIVITY
android:windowSoftInputMode="adjustResize"
如果是fragment,只需要在代码里面控制
context.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
补:这样设置的话,软键盘弹出和消失,都会有延时动作,建议加上背景,默认的是黑色无背景
context.getWindow().setBackgroundDrawableResource(XXXX);
更多相关文章
- LisetView Item高度设置无效
- Android(安卓)View动画——自定义View动画
- android 系统配置 常用命令 - linux
- 调用Android系统设置
- Robolectric使用(一)简单使用
- Android设置Toast长时间显示,及AlertDialog的使用
- 自定义实现横向圆角进度条——简易版
- Android提供的系统服务之--AlarmManager(闹钟服务)
- linux: 编译android源代码流程,以及linux环境变量设置。