首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何用adjustPan滚动布局

如何用adjustPan滚动布局
EN

Stack Overflow用户
提问于 2019-02-20 07:33:01
回答 2查看 714关注 0票数 1

我的fragment中有一个fragment,在nestedscrollview下面有一个按钮,当键盘到达按钮在键盘上方移动时,整个布局正确地处理它的滚动,但问题是背景图像会收缩。

我在我的报表文件中使用了android:windowSoftInputMode="stateAlwaysHidden|adjustResize",如果我使用adjustPan,那么视图不会滚动整个布局移位。

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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-02-20 09:52:33

遵循如下步骤:在此之后,您可以实现您想要的东西:(下面的代码是MainActivity.xml代码)在此代码中,图像视图是您的背景图像。

代码语言:javascript
复制
<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>

在清单中:

代码语言:javascript
复制
 android:windowSoftInputMode="adjustResize"
票数 3
EN

Stack Overflow用户

发布于 2019-02-20 07:36:52

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54781008

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档