我的fragment中有一个fragment,在nestedscrollview下面有一个按钮,当键盘到达按钮在键盘上方移动时,整个布局正确地处理它的滚动,但问题是背景图像会收缩。
我在我的报表文件中使用了android:windowSoftInputMode="stateAlwaysHidden|adjustResize",如果我使用adjustPan,那么视图不会滚动整个布局移位。
我知道这个问题问了很多次,但我没有找到正确的答案。请帮帮忙。
发布于 2019-02-20 09:52:33
遵循如下步骤:在此之后,您可以实现您想要的东西:(下面的代码是MainActivity.xml代码)在此代码中,图像视图是您的背景图像。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAppBack"
tools:context=".activities.LoginActivity">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/login_image_min_2" />
</ScrollView>
// Your container layout which contains fragments like framelayout or what ever you are using
</RelativeLayout>在清单中:
android:windowSoftInputMode="adjustResize"发布于 2019-02-20 07:36:52
您的图像正在缩小,因为您已经在滚动视图中添加了图像。尝试将图像添加到滚动视图的外侧,因为图像是背景图像。这样图像就不会滚动。
https://stackoverflow.com/questions/54781008
复制相似问题