Scrollview在显示android软键盘时向上推

Scrollview在显示android软键盘时向上推,第1张

概述我在scrollView中有一个editext.当editext获得焦点并显示软键盘时,ScrollView会自动向上推. 我试过了 机器人:windowSoftInputMode = “adjustResize” 机器人:windowSoftInputMode = “adjustPan” <RelativeLayout xmlns:android="http://schemas.android. 我在scrollVIEw中有一个editext.当editext获得焦点并显示软键盘时,ScrollVIEw会自动向上推.

我试过了

机器人:windowsoftinputMode = “adjustResize”
机器人:windowsoftinputMode = “adjustPan”

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:tools="http://schemas.androID.com/tools"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:background="@drawable/sign_in_or_sign_up_bg" ><relativeLayout    androID:ID="@+ID/headerlayout"    androID:layout_wIDth="fill_parent"    androID:layout_height="wrap_content"    androID:layout_alignParenttop="true"    androID:background="@drawable/headerBox_Title" >    <Imagebutton        androID:ID="@+ID/backimgBtn"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:layout_alignParentleft="true"        androID:layout_centerVertical="true"        androID:background="@null"        androID:src="@drawable/backarrow" /></relativeLayout><ScrollVIEw    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:layout_below="@+ID/headerlayout"    androID:fillVIEwport="true" >    <linearLayout        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:layout_gravity="center"        androID:gravity="center"        androID:orIEntation="vertical" >        <Imagebutton            androID:ID="@+ID/profilePicimgBtn"            androID:layout_wIDth="@dimen/sign_up_profile_pic"            androID:layout_height="@dimen/sign_up_profile_pic"            androID:layout_gravity="center_horizontal"            androID:background="@null"            androID:scaleType="centerCrop"            androID:src="@drawable/attach_image" />        <EditText            androID:ID="@+ID/usernameEdt"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_margintop="@dimen/sign_in_small_margin"            androID:background="@drawable/text_Box"            androID:hint="Username"            androID:imeOptions="actionNext"            androID:padding="@dimen/edt_padding"            androID:singleline="true"            androID:textSize="@dimen/edt_hint" />        <EditText            androID:ID="@+ID/emailEdt"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_margintop="@dimen/sign_in_small_margin"            androID:background="@drawable/text_Box"            androID:hint="Email"            androID:imeOptions="actionNext"            androID:inputType="textEmailAddress"            androID:padding="@dimen/edt_padding"            androID:singleline="true"            androID:textSize="@dimen/edt_hint" />        <EditText            androID:ID="@+ID/passwordEdt"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_margintop="@dimen/sign_in_small_margin"            androID:background="@drawable/text_Box"            androID:hint="Password"            androID:imeOptions="actionNext"            androID:inputType="textPassword"            androID:padding="@dimen/edt_padding"            androID:singleline="true"            androID:textSize="@dimen/edt_hint" />        <EditText            androID:ID="@+ID/retypePasswordEdt"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_margintop="@dimen/sign_in_small_margin"            androID:background="@drawable/text_Box"            androID:hint="Retype Password"            androID:imeOptions="actionDone"            androID:inputType="textPassword"            androID:padding="@dimen/edt_padding"            androID:singleline="true"            androID:textSize="@dimen/edt_hint" />        <Imagebutton            androID:ID="@+ID/signUpimgBtn"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_margintop="@dimen/sign_in_large_margin"            androID:background="@null"            androID:src="@drawable/sing_up_main_btn" />    </linearLayout></ScrollVIEw>
解决方法 在你的oncreate添加
getwindow().setSoftinputMode(WindowManager.LayoutParams.soFT_input_ADJUST_PAN);

更新

尝试将此添加到您的滚动视图

androID:isScrollContainer="false"
总结

以上是内存溢出为你收集整理的Scrollview在显示android软键盘时向上推全部内容,希望文章能够帮你解决Scrollview在显示android软键盘时向上推所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1149018.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存