我的xml包含一个包含背景图像的RelativeLayout和一个包含登录框的LinearLayout:
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:id="@+id/back"
android:background="@drawable/a_hdpi">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/linearlayout_bg"
android:orientation="vertical"
android:padding="10dp"
android:id="@+id/loginbox">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/edittext_top_bg"
android:drawableLeft="@drawable/user"
android:hint="Username"
android:padding="10dp"
android:singleLine="true"
android:textColorHint="#cccccc" >
<requestFocus />
</EditText>
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-2dp"
android:background="@drawable/edittext_bottom_bg"
android:drawableLeft="@drawable/password"
android:hint="Password"
android:padding="10dp"
android:password="true"
android:singleLine="true"
android:textColorHint="#cccccc" />
<Button
android:id="@+id/submit"
style="@style/DefaultButtonText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="@drawable/button_default_bg"
android:padding="10dp"
android:text="Login" />
</LinearLayout>
</RelativeLayout>
现在,当打开软键盘时,它会根据我设置的选项进行平移或调整大小(根据getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
),但我想要做的是PAN LinearLayout,但保留RelativeLayout和全尺寸。
这可能吗?我无法找到有关如何管理两个嵌入式布局的任何其他问题/答案或指南。