Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使用adjustPan滚动布局_Android - Fatal编程技术网

Android 如何使用adjustPan滚动布局

Android 如何使用adjustPan滚动布局,android,Android,我的片段中有一个嵌套滚动视图,在嵌套滚动视图的下方有一个按钮,当键盘到达时,按钮移动到键盘上方,整个布局正确处理滚动,但问题是背景图像收缩 我在清单文件中使用了android:windowSoftInputMode=“stateAllwayshidden | adjustResize”,如果我使用adjustPan,则视图不会向上滚动整个布局 我知道这个问题被问了很多次,但我没有找到正确的答案。 请帮助。您的图像正在缩小,因为您也在滚动视图中添加了图像。 尝试将图像添加到滚动视图的外侧,因为图像

我的
片段
中有一个
嵌套滚动视图
,在
嵌套滚动视图
的下方有一个按钮,当键盘到达时,按钮移动到键盘上方,整个布局正确处理滚动,但问题是背景图像收缩

我在清单文件中使用了
android:windowSoftInputMode=“stateAllwayshidden | adjustResize”
,如果我使用
adjustPan
,则视图不会向上滚动整个布局

我知道这个问题被问了很多次,但我没有找到正确的答案。
请帮助。

您的图像正在缩小,因为您也在滚动视图中添加了图像。 尝试将图像添加到滚动视图的外侧,因为图像是背景图像。 这样图像就不会滚动。

按照如下步骤操作: 之后,您就可以实现您想要的:(下面的代码是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>

谢谢你的回答。我的活动xml中有图像视图,片段与该活动一起附加。碎片具有透明背景以突出显示该图像。那么在这种情况下我该怎么办呢?嘿,你试过这个了吗:getWindow().setBackgroundDrawableResource(R.drawable.your_image_resource);从XML文件中删除背景图像。是的,我也尝试过
 android:windowSoftInputMode="adjustResize"