我的Android应用程序的主活动看起来像这样:
为了确保在键盘弹出时,第一个RelativeLayout中定义的背景图像不会被压缩,我在活动的清单文件中设置了
但问题是我的ScrollView现在无法工作,因为我认为由于上述修改清单文件,系统认为窗口不需要调整大小,所以ScrollView未被激活。当我将
有没有办法编写代码,使我的背景不被压缩,而我的ScrollView仍然可以工作?谢谢!
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:orientation="vertical"
android:paddingLeft="60dp"
android:paddingTop="53dp" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/billAmountText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/billAmount_string"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/billAmount"
android:layout_width="173dp"
android:layout_height="wrap_content"
android:layout_below="@id/billAmountText"
android:layout_marginTop="3dp"
android:inputType="numberDecimal" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
为了确保在键盘弹出时,第一个RelativeLayout中定义的背景图像不会被压缩,我在活动的清单文件中设置了
android:windowSoftInputMode="stateVisible|adjustPan"
。现在背景和布局都没有问题,没有任何内容被调整大小。但问题是我的ScrollView现在无法工作,因为我认为由于上述修改清单文件,系统认为窗口不需要调整大小,所以ScrollView未被激活。当我将
android:windowSoftInputMode="stateVisible|adjustPan"
移除时,滚动起作用,但当键盘弹出时,背景被压缩。有没有办法编写代码,使我的背景不被压缩,而我的ScrollView仍然可以工作?谢谢!