滚动视图内的RelativeLayout不滚动

2023-11-29

我尝试用滚动视图包装我的相对布局以在横向模式下使用,但它不起作用。我还尝试用 Linearlayout 包装我的相对布局,但它也不起作用。

这是将relativelayout包装在scrollview中的xml:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
    android:fillViewport="true">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#2d89ef">
    <!--Some components here-->
    </RelativeLayout>
    </ScrollView>

这是我的完整 xml:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
    android:fillViewport="true">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#2d89ef">

    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="Segoe UI Light"
        android:gravity="center"
        android:text="@string/app_name"
        android:textColor="#FFFFFF"
        android:textSize="25dp"
        android:textIsSelectable="false"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="10dp" />

    <EditText
        android:id="@+id/editText"
        android:layout_width="275dp"
        android:layout_height="wrap_content"
        android:ems="10"
        android:fontFamily="Segoe UI Light"
        android:gravity="center_vertical"
        android:hint="@string/username"
        android:inputType="textPersonName"
        android:textColor="@android:color/white"
        android:textSize="16sp"
        android:width="200dp"
        android:layout_below="@+id/textView"
        android:layout_centerHorizontal="true">

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/editText2"
        android:layout_width="250dp"
        android:layout_height="wrap_content"
        android:ems="10"
        android:fontFamily="Segoe UI Light"
        android:gravity="center_vertical"
        android:hint="@string/password"
        android:inputType="textPassword"
        android:textColor="@android:color/white"
        android:textSize="16sp"
        android:width="200dp"
        android:layout_below="@+id/editText"
        android:layout_alignRight="@+id/editText"
        android:layout_alignLeft="@+id/editText" />

    <Button
        android:id="@+id/button"
        android:layout_width="250dp"
        android:layout_height="40dp"
        android:background="@drawable/border"
        android:fontFamily="Segoe UI Light"
        android:height="20dp"
        android:text="@string/login"
        android:textColor="#FFFFFF"
        android:textSize="15sp"
        android:width="200dp"
        android:layout_marginTop="25dp"
        android:layout_below="@+id/editText2"
        android:layout_alignLeft="@+id/editText2"
        android:layout_alignRight="@+id/editText2" />

    <Button
        android:id="@id/btnForgot"
        android:layout_width="250dp"
        android:layout_height="40dp"
        android:background="@drawable/border"
        android:fontFamily="Segoe UI Light"
        android:height="20dp"
        android:text="@string/forgot_password"
        android:textColor="#FFFFFF"
        android:textSize="15sp"
        android:width="200dp"
        android:layout_below="@+id/button"
        android:layout_alignLeft="@+id/button"
        android:layout_alignRight="@+id/button" />

    <ImageView
        android:layout_width="140dp"
        android:layout_height="200dp"
        android:id="@+id/imageView"
        android:background="@drawable/auf_logo"
        android:layout_above="@+id/textView"
        android:layout_centerHorizontal="true" />

</RelativeLayout>
</ScrollView>

检查我下面的代码..它与您的布局相同。所以只需更换它并检查它......

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#2d89ef"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="140dp"
            android:layout_height="200dp"
            android:layout_centerHorizontal="true"
            android:background="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@id/imageView"
            android:layout_centerVertical="true"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp"
            android:fontFamily="Segoe UI Light"
            android:gravity="center"
            android:text="@string/app_name"
            android:textColor="#FFFFFF"
            android:textIsSelectable="false"
            android:textSize="25dp" />

        <EditText
            android:id="@+id/editText"
            android:layout_width="275dp"
            android:layout_height="wrap_content"
            android:layout_below="@+id/textView"
            android:layout_centerHorizontal="true"
            android:ems="10"
            android:fontFamily="Segoe UI Light"
            android:gravity="center_vertical"
            android:inputType="textPersonName"
            android:textColor="@android:color/white"
            android:textSize="16sp"
            android:width="200dp" >

            <requestFocus />
        </EditText>

        <EditText
            android:id="@+id/editText2"
            android:layout_width="250dp"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/editText"
            android:layout_alignRight="@+id/editText"
            android:layout_below="@+id/editText"
            android:ems="10"
            android:fontFamily="Segoe UI Light"
            android:gravity="center_vertical"
            android:inputType="textPassword"
            android:textColor="@android:color/white"
            android:textSize="16sp"
            android:width="200dp" />

        <Button
            android:id="@+id/button"
            android:layout_width="250dp"
            android:layout_height="40dp"
            android:layout_alignLeft="@+id/editText2"
            android:layout_alignRight="@+id/editText2"
            android:layout_below="@+id/editText2"
            android:layout_marginTop="25dp"
            android:fontFamily="Segoe UI Light"
            android:height="20dp"
            android:text="Login"
            android:textColor="#FFFFFF"
            android:textSize="15sp"
            android:width="200dp" />

        <Button
            android:id="@+id/btnForgot"
            android:layout_width="250dp"
            android:layout_height="40dp"
            android:layout_alignLeft="@+id/button"
            android:layout_alignRight="@+id/button"
            android:layout_below="@+id/button"
            android:fontFamily="Segoe UI Light"
            android:height="20dp"
            android:text="Forgot Password"
            android:textColor="#FFFFFF"
            android:textSize="15sp"
            android:width="200dp" />
    </RelativeLayout>
</LinearLayout>

</ScrollView>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

滚动视图内的RelativeLayout不滚动 的相关文章

  • Android:使用 OAuth 访问 google 任务时出现问题

    由于 google 任务没有公共 api 我想编写解决方法并像浏览器一样请求数据 然后解析结果以进一步显示 为了访问数据 我使用 google 实现了 OAuth 身份验证来访问此 url https mail google com htt
  • FTS3 在 ORMLite 中搜索?

    我对 FTS3 一无所知 除了http developer android com guide topics search search dialog html http developer android com guide topics
  • Android 上的 SVG 支持

    Android 支持 SVG 吗 有什么例子吗 最完整的答案是这样的 Android 2 x 默认浏览器本身不支持 SVG Android 3 默认浏览器支持 SVG 要将 SVG 支持添加到 2 x 版本的平台 您有两个基本选择 安装功能
  • Service 和 IntentService,运行从服务器轮询数据库值的服务哪个更好?

    我读过很多关于Service and IntentService 然而 当做出决定时 我没有足够的信心选择使用哪种类型来创建一个后台服务 该服务将在一定时间间隔内从数据库轮询数据 并在获得所需数据时停止它 因为数据代表请求的状态 例如 订购
  • Android 自定义布局 - onDraw() 永远不会被调用

    public class MainActivity extends Activity Override public void onCreate Bundle savedInstanceState super onCreate savedI
  • AudioTrack、SoundPool 或 MediaPlayer,我应该使用哪个?

    如果我需要能够 播放多个音频文件 具有不同的持续时间 例如 5 到 30 秒 独立设置右 左声道的音量 应用声音效果 如混响 失真 那么 我应该使用哪个 API 另外 我在 AudioTrack API 上找不到太多文档 有谁知道在哪里可以
  • 如何在手机缓存中保存用户名和密码

    我有一个用户登录应用程序 它需要用户的电子邮件和密码 我想将电子邮件和密码保存在手机缓存中 以便用户不必再次输入 有什么办法可以将数据保存在Android缓存中吗 我认为你需要使用SharedPreference用于在设备中使用应用程序时保
  • Android 服务是否有办法检测设备何时锁定?

    我有一个 Android 服务 我希望在设备锁定时执行操作 我想澄清一下 我对屏幕开 关状态不感兴趣 我知道如何使用带有 Intent ACTION USER PRESENT 和 KeyguardManager inKeyguardRest
  • Android 应用程序中的 Eszett (ß)

    我的 res layout activity 文件中的德语 字符在我的应用程序中自动转换为 ss 即使我将语言和键盘设置为德语 它仍然不会显示 Android 中可以显示 吗 edit
  • 获取手机的 z 轴和磁北极(而不是 y 轴)之间的角度

    我知道如何使用 getOrientation 方法获取手机 y 轴和磁北之间的方向角 如此处所述https developer android com guide topics sensors sensors position https
  • 在旋转时从错误的资源文件夹中提取可绘制对象

    在这里拉我的头发 因此 我正在使用一个具有多种类型的可绘制对象的应用程序 并且它们的结构如下 res Portrait resources drawable mdpi drawable hdpi drawable xhdpi Landsca
  • 将 Firebase 云消息传递与 Windows 应用程序结合使用

    我在 Android 和 iOS 应用程序中使用 Firebase Cloud Messaging 但是我还有此应用程序的 Windows Mac OS 版本 我想保留相同的逻辑 我知道 Firebase Cloud Messaging 可
  • 有关 ListView 自定义行布局项目上的 onClick() 事件的帮助

    我有一个 ListView 其行由我格式化 每行都有 ImageView 和 TextView 的混合 我还实现了自己的适配器 并且能够通过它绘制每一行 现在 我想要这样的东西 用户单击 ImageView 不是行上的其他任何位置 但只有此
  • 如何修改 Skobbler 注释而不重新添加它

    我必须修改 SKAnnotation 的图像 注释生成器代码 private SKAnnotation getAnnotationFromView int id int minZoomLvl View view SKAnnotation a
  • 按钮 - 单击时更改背景颜色

    我的活动中有 8 个按钮 我正在寻找的是 按钮具有默认背景 单击按钮时 背景颜色应更改为其他颜色 这部分非常简单 但是 当我单击任何其他按钮时 第一个按钮的背景颜色应该变回默认颜色 我知道这将使用 选择器状态 来完成 但我不太确定如何实现它
  • 如何在 Android 中使用 C# 生成的 RSA 公钥?

    我想在无法假定 HTTPS 可用的情况下确保 Android 应用程序和 C ASP NET 服务器之间的消息隐私 我想使用 RSA 来加密 Android 设备首次联系服务器时传输的对称密钥 RSA密钥对已在服务器上生成 私钥保存在服务器
  • Android:AsyncTask ProgressDialog 将不会在 ActivityGroup 中打开

    我试图在轮询我的服务器时打开一个进度对话框 该类是一个 ActivityGroup 因为它嵌套在选项卡栏中 为了将视图保持在框架内 需要 ActivityGroup 这是我的 ActivityGroup 类的声明 public class
  • Android 中循环事件的星期几和时间选择器

    我想创建一个控件 允许用户在我的 Android 活动中选择一周中的某一天 星期一 和一天中的某个时间 下午 1 00 找不到任何关于此的好帖子 好吧 我想我已经明白了 我只是不喜欢这个解决方案 因为我在一周中的某一天使用的微调器与时间选择
  • javafx android 中的文本字段和组合框问题

    我在简单的 javafx android 应用程序中遇到问题 问题是我使用 gradle javafxmobile plugin 在 netbeans ide 中构建了非常简单的应用程序 其中包含一些文本字段和组合框 我在 android
  • 使用单选按钮更改背景颜色 Android

    我试图通过从单选组中选择单选按钮来更改应用程序选项卡的背景 但是我不确定如何执行此操作 到目前为止我已经 收藏夹 java import android app Activity import android os Bundle publi

随机推荐

  • 将 PHP 数组传递给函数?

    我有以下代码 params array api user gt user api key gt pass to gt email protected subject gt testing from curl html gt testing
  • 如何更改 JAX-RS 应用程序中的 Jackson 版本 (WebSphere Liberty)

    我正在将 JAX RS 应用程序从 WebSphere 8 0 迁移到 WebSphere Liberty 8 5 5 在WebSphere 8 0 中 Jackson 由WebSphere 提供 我可以找到jackson core asl
  • 从 read 调用中得到负一

    我使用 SQL Developer 连接到具有只读访问权限的数据库 这是 TNS 连接 我使用 tnsnames ora 转发端口脚本和 SQL Developer 过去 有时在连接时会收到错误消息 从 read 调用中得到负一 供应商代码
  • 当通过启动器中的图标按下启动时,应用程序完全重新启动

    我正在尝试制作我的第一个 Android 应用程序的发布版本 以发送给一些测试人员 然而 我遇到了一个问题 当您退出应用程序 然后通过其图标启动它重新进入它时 它会重新启动整个应用程序 而不是返回到之前的位置 即使您退出后立即重新进入 也会
  • 如果未使用 CloseHandle 正确关闭,则重新打开串行端口会失败

    我正在 Windows 上使用 USB 设备 该设备被视为虚拟串行端口 我可以使用 CreateFile 和 ReadFile 函数与设备进行通信 但在某些情况下 我的应用程序不会调用 CloseHandle 当我的应用程序在开发中崩溃时
  • 混合模式程序集是针对版本“v1.1.4322”构建的

    我在 c net 4 0 应用程序中包含了一个 directX 播放器 该应用程序包含在此处 答案2 问题是 当我尝试初始化对象 即 Player mPlayer new Player 时 会发生此错误 混合模式程序集是针对运行时版本 v1
  • 画布被跨源数据污染

    我正在从我可以信任的第三方网站加载动态 jpeg 我试图getImageData 但浏览器 Chrome 23 0 抱怨 Unable to get image data from canvas because the canvas has
  • 快速找到以2为底的对数的整数部分

    计算浮点数以 2 为底的对数的整数部分的有效方法是什么 就像是 N ceil log2 f or N floor log2 f 对于浮点数 f 我想这可以以某种方式非常有效地实现 因为人们可能只需要访问浮点指数 EDIT2 我主要不感兴趣精
  • 参与者数量为奇数的每周小组分配算法

    问题有一个循环解决方案我之前问过 它对于偶数的人来说效果很好 但是一旦你实现了算法并尝试了它们 这些建议似乎都不起作用 我已经尝试了很多变化并且 将最后一个与一大堆其他人分组 第二组最后一组 不同的组合 2和4到底行的最后一个 我认为这会给
  • 检索 Matplotlib 热图颜色

    我正在尝试检索 matplotlib 热图上每个单元格的颜色 该热图由imshow 功能 例如由magic function below import matplotlib pyplot as plt import numpy as np
  • 如何使用 javascript d3 打开 json 文件?

    我正在尝试使用 javascript 从 JSON 文件中提取元素 但是收到一条错误消息 指出它无法加载 JSON 文件 这就是我的代码的样子
  • 异步nodejs执行顺序

    processItem什么时候开始执行 是否在某些项目被推入队列后立即开始 或者 for 循环必须在队列中的第一项开始执行之前完成 var processItem function item callback console log ite
  • 将列插入 pandas 数据框

    设想 我有一段代码 可以将 Excel 工作表中的数据读取到数据框中 合并到一个数据框中 并执行一些清理过程 Issue 我试图使用 pd insert 将具有给定值的列添加到数据帧的开头 但每次运行此行时 数据帧都会从变量资源管理器中消失
  • 从 Facebook API 将数据插入 Meteor

    我按照给出的例子here从 FB Graph 中提取数据 到目前为止 我已经设法从 FB 中提取数据 但我不知道如何将其插入到 MongoDB 中 目前 Facebook 的数据呈现如下 data picture https photo j
  • 将 Ajax 与 jQuery DataTables 结合使用时,如何确定如何处理返回的数据?

    像许多其他人一样 我查看类似问题的各种答案 在网上搜索示例等 但除非我碰巧找到我遇到的几乎相同的情况 否则我无法弄清楚如何让 DataTable 填充阿贾克斯呼叫 我认为如果有人能够解释所发生的步骤以及如何使用 DataTables 的 A
  • 按字典顺序查找排列列表中给定排列的索引[重复]

    这个问题在这里已经有答案了 可能的重复 给定一个字符串和该字符串的排列 在字符串排列的排序列表中查找该排列字符串的索引 这是一道面试题 假设有一个按字典顺序排列的排列列表 例如 123 132 213 231 312 321 给定一个排列
  • 两种不同的交换功能有什么区别?

    我想知道两种代码在性能上的区别 有什么优点和缺点 Code 1 temp a a b b temp Code 2 a a b b a b a a b 第一种技术的优点是它是一个通用的习语 明显且正确 它适用于任何地方 任何类型的变量 它很可
  • 涉及 SUM、LEFT JOIN 和 GROUP BY 的重复

    我遇到了涉及 SUM LEFT OUTER JOIN 和 GROUP BY 命令的问题 但无法找出错误所在 我有两张表 一张用于客户交易 一张用于客户索赔 客户可以有多个交易和多个索赔 但在两个表中 行都是唯一的 客户也不能提出索赔 交易表
  • 错误地使用了当前工作目录...我的数据库到底在哪里?

    我知道为 SQLite 数据库设置数据库名称意味着设置 DB 文件的路径 我这样设置 db setDatabaseName DienstplanerDB sqlite 这是错误的 事情不是这样的 但我做到了 不知怎的 它起作用了 但我无法通
  • 滚动视图内的RelativeLayout不滚动

    我尝试用滚动视图包装我的相对布局以在横向模式下使用 但它不起作用 我还尝试用 Linearlayout 包装我的相对布局 但它也不起作用 这是将relativelayout包装在scrollview中的xml