Android:EditText保持隐藏在键盘后面

Android:EditText保持隐藏在键盘后面,第1张

概述在写这个问题之前,我已经阅读了以下答案/文章: > Android soft keyboard covers edittext field > Android keyboard obscures EditText > http://developer.android.com/resources/articles/on-screen-inputs.html > Soft Keyboard Overl 在写这个问题之前,我已经阅读了以下答案/文章:

> Android soft keyboard covers edittext field
> Android keyboard obscures EditText
> http://developer.android.com/resources/articles/on-screen-inputs.html
> Soft Keyboard Overlapping with EditText Field

AndroID软键盘默认设置为平移,这意味着它将保留键盘上方的所有可编辑区域.但是它不够泛.当我运行它并按下接近屏幕底部的edittext时,键盘出现,edittext被上移,但不足以看到正在键入的内容.我已经使用/尝试了以下内容:

> androID:windowsoftinputMode =“adjustPan”在Activity的清单中.这没有什么区别.我也试过设置adjustUnspecifIEd和adjustResize的值.他们都没有工作.
>< uses-sdk androID:minSdkVersion =“3”/>在清单文件中.我的应用程序是针对sdk 2.1及以上版本的.尽管如此,我尝试过并没有奏效.
>使用ScrollVIEw.也不行.

有没有办法手动管理当按下特定的edittext时键盘做多少“平移”.

以下是我的xml文件.

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent"androID:background="#ffffff">           <ImageVIEw     androID:ID="@+ID/header"    androID:layout_wIDth="320dip"    androID:layout_height="86dip"    androID:background="@drawable/header_bg">    </ImageVIEw>    <ImageVIEw     androID:layout_wIDth="320dip"    androID:layout_height="200dip"    androID:layout_alignParentBottom="true"    androID:background="@drawable/bg1_btm">    </ImageVIEw>        <TextVIEw androID:text="Hostname"         androID:ID="@+ID/lbl_hostname"        androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"         androID:layout_below="@ID/header"/>        <TextVIEw androID:text="(Current)"         androID:ID="@+ID/lbl_hostname_current"        androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"        androID:layout_toRightOf="@ID/lbl_hostname"        androID:layout_below="@ID/header" />        <EditText androID:text="EditText"         androID:ID="@+ID/editText_hostname"         androID:layout_below="@ID/lbl_hostname"          androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"        androID:maxLength="25">        </EditText>        <TextVIEw androID:text="Registration URL"         androID:ID="@+ID/lbl_registration"        androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"        androID:layout_below="@ID/editText_hostname" />        <TextVIEw androID:text="(Current)"         androID:ID="@+ID/lbl_registration_current"        androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"        androID:layout_below="@ID/editText_hostname"        androID:layout_toRightOf="@ID/lbl_registration" />        <TextVIEw androID:text="http://"         androID:ID="@+ID/lbl_url_prefiz"        androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"        androID:layout_below="@ID/lbl_registration"        androID:paddingtop="10dip" />        <EditText androID:text="EditText"         androID:ID="@+ID/editText_registration"         androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"        androID:layout_toRightOf ="@ID/lbl_url_prefiz"        androID:layout_below="@ID/lbl_registration">        </EditText>        <TextVIEw androID:text="Chat"         androID:ID="@+ID/lbl_chat"        androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"         androID:layout_below="@ID/editText_registration"/>        <TextVIEw androID:text="(Current)"         androID:ID="@+ID/lbl_chat_current"        androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"         androID:layout_below="@ID/editText_registration"        androID:layout_toRightOf="@ID/lbl_chat"/>        <EditText androID:text="EditText"         androID:ID="@+ID/editText_chat"         androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"         androID:layout_below="@ID/lbl_chat">        </EditText>        <TextVIEw androID:text="SSID"         androID:ID="@+ID/lbl_ssID"        androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"        androID:layout_below="@ID/editText_chat" />        <TextVIEw androID:text="(Current)"         androID:ID="@+ID/lbl_ssID_current"        androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"        androID:layout_below="@ID/editText_chat"        androID:layout_toRightOf="@ID/lbl_ssID"        />        <EditText androID:text="EditText"         androID:ID="@+ID/editText_ssID"         androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"         androID:layout_below="@ID/lbl_ssID"        androID:maxlines="1"        androID:inputType="text"        androID:layout_marginBottom="25dip">        </EditText>         <button androID:layout_wIDth="wrap_content"         androID:layout_height="wrap_content"         androID:ID="@+ID/buttonSave"         androID:text="Save"         androID:layout_below="@ID/editText_ssID"        androID:layout_alignParentleft="true">        </button>        <button androID:text="Continue"         androID:layout_height="wrap_content"         androID:layout_wIDth="wrap_content"         androID:ID="@+ID/buttonContinue"         androID:layout_below="@ID/editText_ssID"         androID:layout_alignParentRight="true">        </button></relativeLayout>
解决方法 尝试
androID:windowsoftinputMode="adjustResize"

为我工作很好:)

总结

以上是内存溢出为你收集整理的Android:EditText保持隐藏在键盘后面全部内容,希望文章能够帮你解决Android:EditText保持隐藏在键盘后面所遇到的程序开发问题。

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

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

原文地址:https://www.54852.com/web/1131596.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存