为了账号安全,请及时绑定邮箱和手机立即绑定

键盘打开时调整布局大小

键盘打开时调整布局大小

慕妹3242003 2021-12-10 14:55:44
我想在软键盘打开时调整我的活动布局。我试着把它放在清单中:android:windowSoftInputMode="adjustResize"但它不起作用。这是我的 xml 布局:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:fitsSystemWindows="true"    tools:context=".ui.SettingsActivity">    <!-- BODY -->    <ScrollView        android:id="@+id/scrollViewBody"        android:layout_width="match_parent"        android:layout_height="match_parent">        <LinearLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:orientation="vertical">            <!-- my list -->        </LinearLayout>    </ScrollView>    <!-- TOOLBAR -->    <include layout="@layout/toolbar" />键盘打开时布局不会调整大小...请帮帮我
查看完整描述

1 回答

?
饮歌长啸

TA贡献1951条经验 获得超3个赞

文档

"adjustResize" 活动的主窗口总是调整大小,为屏幕上的软键盘腾出空间。

"adjustPan" 活动的主窗口不会调整大小来为软键盘腾出空间。相反,窗口的内容会自动平移,因此当前焦点永远不会被键盘遮挡,用户始终可以看到他们正在键入的内容。这通常不如调整大小理想,因为用户可能需要关闭软键盘才能进入窗口的模糊部分并与之交互。

我相信你想要的是adjustPan


查看完整回答
反对 回复 2021-12-10
  • 1 回答
  • 0 关注
  • 131 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号