在写这个问题之前,我已经阅读了以下答案/文章:
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) 在我的应用程序中,当我单击EditText视图时,虚拟键盘会遮挡视图,因此我无法看到我的编辑内容.我该如何以编程方式解决此问题?
在我的布局中,TextView屏幕底部有一个.问题是,当我在文本框内单击以键入内容时,键盘覆盖文本框,因此我无法看到发生了什么......有什么解决方案吗?这是我的布局......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/layout_bg">
<ImageView
android:id="@+id/headerimg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:src="@drawable/header_image" />
<LinearLayout
android:id="@+id/secondaryLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="320dip"
android:layout_marginTop = "5dip"
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
android:cacheColorHint="#00000000">
<!-- A ListView appears here -->
</LinearLayout>
<RelativeLayout
android:id="@+id/message"
android:orientation="horizontal"
android:layout_width="300dip"
android:layout_height="80dip"
android:layout_gravity="center">
<EditText
android:id="@+id/MessageText"
android:layout_height="wrap_content"
android:layout_width="230dip"
android:layout_marginLeft="8dip"
android:layout_marginTop = "8dip"
android:paddingBottom = "8dip"
android:paddingLeft="15px"
android:hint="Type something here...">
</EditText>
<Button
android:id="@+id/MsgButton"
android:layout_margin="0dip"
android:layout_width="48dip"
android:layout_toRightOf="@id/MessageText"
android:layout_height="48dip">
</Button>
</RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)