在写这个问题之前,我已经阅读了以下答案/文章:
Android软键盘默认设置为平移,这意味着它将保持键盘上方的所有可编辑区域.然而,它不泛不够.当我运行它并按下靠近屏幕底部的edittext时,键盘出现并且edittext向上移动但不足以查看其中键入的内容.我用过/试过以下内容:
android:windowSoftInputMode="adjustPan"在活动的清单中.这没有任何区别.我也试图把价值观adjustUnspecified和adjustResize太.它们都不起作用.
<uses-sdk android:minSdkVersion="3" />在清单文件中.我的应用程序针对sdk 2.1及更高版本.尽管如此,我尝试过它并没有奏效.
使用ScrollView.也不起作用.
有没有办法手动管理按下特定编辑文本时键盘执行多少"平移".
下面是我的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" …Run Code Online (Sandbox Code Playgroud) 我发现这个老帖子肯定有助于我的问题,但我注意到它似乎并没有解决我的问题.我已经收集到我需要为我的活动设置android:windowSoftInputMode ="adjustPan".但问题在于它根本不能平息.
文本字段位于视图的底部,当键盘显示时,视图稍微移动,但仅移动EditText的最顶部.文本字段已启用自动填充功能,当它开始显示自动填充选项时,视图会稍微向下缩小,但实际上会被自动填充选项进一步遮挡.它使文本输入字段非常难以使用,因为您无法看到正在键入的任何内容.
它是一个多行输入字段,当文本滚动到下一行时,视图平移得更远,因此您实际上可以看到前一行文本.但你看不出你在打字的东西,我觉得这很重要.
有没有人对解决这个问题有任何想法?