【发布时间】:2015-10-07 10:36:33
【问题描述】:
我有一个布局:
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
xmlns:android.support.design="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/activity_background"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_content_clear_login_36dp"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:scrollbars="none"
>
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<!--Activity widgets: Edittext etc all come here-->
</LinearLayout>
</ScrollView>
</LinearLayout>
当软键盘打开时,如果在清单文件中设置了android:windowSoftInputMode="stateVisible|adjustResize",则在根布局 (LinearLayout) 中设置的背景图像会调整大小,如果在清单文件中设置了android:windowSoftInputMode="stateVisible|adjustPan",则会向上滚动。
我希望背景图像保留在其位置,并且只使内容(根布局的子视图)向上滚动。
有什么指南吗?
【问题讨论】: