解决android 输入法弹出时候 屏幕整体上移

<activity

            android:windowSoftInputMode="stateHidden|adjustResize"

            />

布局中使用滚动条scrollview 控制滑动范围,例如标题下方

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
实现输入后,布局整体的效果可以通过给根布局设置android:fitsSystemWindows="true"属性来实现。 同时,为了使顶部部分固定,可以将顶部部分放在一个固定高度的布局中,将中间部分放在一个可滚动的布局中。当输入时,中间部分的布局会被上,而顶部部分则不会受到影响。 以下是一个示例布局文件: ``` <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <!-- 顶部部分,设置固定高度 --> <RelativeLayout android:id="@+id/top_layout" android:layout_width="match_parent" android:layout_height="60dp" android:background="@color/colorPrimary"/> <!-- 中间部分,放在可滚动的布局中 --> <ScrollView android:layout_below="@id/top_layout" android:layout_above="@+id/bottom_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- 中间部分的内容 --> </LinearLayout> </ScrollView> <!-- 底部部分,放置输入框等控件 --> <RelativeLayout android:id="@+id/bottom_layout" android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content"> <!-- 底部部分的控件 --> </RelativeLayout> </RelativeLayout> ``` 注意,这只是一个示例布局,具体实现还需要根据实际需求进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值