将多个嵌套的 LineairLayout 转换为单个relativelayout

2023-12-29

首先,我总体上对用户界面很不好,这就是为什么我需要一些帮助。现在我有以下内容:

Explained with a Paint picture: enter image description here

Actual Screenshot of what I currently have: enter image description here

代码可以在这篇文章的底部找到。这是通过一些嵌套的 LineairLayouts 和权重来完成的。

What I want now is the following: enter image description here

  1. ImageButton(宽度和高度已知/图像在 xml 中设置)
  2. TextView(高度已知,宽度应填充在 1 到 3 之间)
  3. TextView(高度已知,宽度(文本)未知)
  4. EditText(高度已知,宽度(文本)未知)
  5. AutoCompleteTextView(高度已知,宽度应填充在 4 到 9 之间)
  6. TextView(宽度和高度已知/文本在xml中设置)
  7. Spinner(高度已知,宽度应填充在 6 到 8 之间)
  8. ImageButton(宽度和高度已知/图像在 xml 中设置)这是我现在想添加的。
  9. 空间(宽度和高度均在代码中确定以填充空白)

我知道我可能能够弄清楚如何添加此 ImageButton 与另一个嵌套 LineairLayout 和嵌套权重,但由于我的应用程序的性能已经不是那么好,并且我目前正在尝试解决很多性能问题,我认为最好将此list_item.xml 转换为单个RelativeLayout。

那么,我该怎么做呢?我只是不喜欢 UI 布局,所以我很感激我能得到的所有帮助。如何使用第二个Paint-image的结果创建RelativeLayout?

当前代码:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xml>
<!-- The DOCTYPE above is added to get rid of the following warning:
     "No grammar constraints (DTD or XML schema) detected for the document." -->

<!-- The View for a single CheckListItem -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/item_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <!-- The TextViews -->
    <LinearLayout
        android:id="@+id/ll1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal" >

        <ImageView
            android:id="@+id/image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/default_margin"
            android:adjustViewBounds="true"
            android:background="@layout/transparent_background"
            android:contentDescription="@string/checkbox_content_description"
            android:src="@drawable/checkbox_unchecked" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginRight="@dimen/default_margin"
            android:layout_marginTop="@dimen/default_margin"
            android:layout_weight="1"
            android:gravity="center_vertical" >

            <TextView
                android:id="@+id/tv_product_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:singleLine="true" />

        </LinearLayout>

        <TextView
            android:id="@+id/tv_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="@dimen/default_margin"
            android:layout_marginTop="@dimen/default_margin" />

    </LinearLayout>

    <!-- The EditTexts -->
    <LinearLayout
        android:id="@+id/ll2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/ll1"
        android:gravity="center"
        android:orientation="horizontal"
        android:visibility="visible" >

        <Space
            android:id="@+id/filler_space_image"
            android:layout_width="1dp"
            android:layout_height="1dp"
            android:layout_marginBottom="@dimen/default_margin"
            android:layout_marginLeft="@dimen/default_margin"
            android:layout_marginRight="@dimen/default_margin" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/default_margin"
            android:layout_marginRight="@dimen/default_margin"
            android:orientation="vertical"
            android:padding="0dp">

            <EditText
                android:id="@+id/et_result_amount"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:inputType="number" />

            <TextView
                android:id="@+id/tv_tags"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/tags"
                android:gravity="center" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/default_margin"
            android:layout_marginRight="@dimen/default_margin"
            android:layout_weight="1"
            android:gravity="center_vertical"
            android:padding="0dp"
            android:orientation="vertical">

            <AutoCompleteTextView
                android:id="@+id/actv_result_name"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:ellipsize="end"
                android:inputType="text"
                android:singleLine="true" />

            <Spinner
                android:id="@+id/sp_tags"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <!--<ImageButton
                android:id="@+id/btn_tags"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:src="@android:drawable/ic_menu_manage"
                android:contentDescription="@string/button_tags_content_description"
                android:background="@layout/transparent_background" />-->

        </LinearLayout>

        <Space
            android:id="@+id/filler_space_price"
            android:layout_width="1dp"
            android:layout_height="1dp"
            android:layout_marginBottom="@dimen/default_margin"
            android:layout_marginRight="@dimen/default_margin" />

    </LinearLayout>

</RelativeLayout>

EDIT 1:

在我尝试过之后@AlexBalo建议 https://stackoverflow.com/a/24888641/1682559快要上班了。只是遇到了麻烦android:layout_leftOf="@id/left_ll".

PS:我的项目有两种不同的状态:一种是未选中/绿色对勾/红叉,仅显示视图 1、2 和 3。另一种是橙黄色对勾,就像提供的图片一样。

以下是 AlexBalo 迄今为止的更改结果:

State unchecked / green check / red cross: enter image description here

State orange-yellow check: enter image description here

使用以下代码:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xml>
<!-- The DOCTYPE above is added to get rid of the following warning:
     "No grammar constraints (DTD or XML schema) detected for the document." -->

<!-- The View for a single CheckListItem -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/item_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/left_ll"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:background="@layout/transparent_background"
            android:contentDescription="@string/checkbox_content_description"
            android:src="@drawable/checkbox_unchecked"
            android:layout_marginTop="@dimen/default_margin"
            android:layout_marginLeft="@dimen/default_margin"
            android:layout_marginBottom="@dimen/default_margin" />

        <Space
            android:id="@+id/filler_space_image"
            android:layout_width="1dp"
            android:layout_height="1dp"
            android:layout_marginLeft="@dimen/default_margin"
            android:layout_marginBottom="@dimen/default_margin" />

    </LinearLayout>

    <TextView
        android:id="@+id/tv_product_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/left_ll"
        android:layout_toLeftOf="@+id/right_ll"
        android:ellipsize="end"
        android:singleLine="true"
        android:layout_marginTop="@dimen/default_margin"
        android:layout_marginLeft="@dimen/default_margin"
        android:layout_marginBottom="@dimen/default_margin" />

    <EditText
        android:id="@+id/et_result_amount"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/tv_product_name"
        android:layout_toRightOf="@id/left_ll"
        android:inputType="number"
        android:layout_marginLeft="@dimen/default_margin"
        android:layout_marginBottom="@dimen/default_margin" />

    <AutoCompleteTextView
        android:id="@+id/actv_result_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/right_ll"
        android:layout_toRightOf="@id/et_result_amount"
        android:layout_below="@+id/tv_product_name"
        android:ellipsize="end"
        android:inputType="text"
        android:singleLine="true" />

    <TextView
        android:id="@+id/tv_tags"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/et_result_amount"
        android:layout_toRightOf="@id/left_ll"
        android:text="@string/tags"
        android:gravity="center"
        android:layout_marginLeft="@dimen/default_margin"
        android:layout_marginBottom="@dimen/default_margin" />

    <Spinner
        android:id="@+id/sp_tags"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/actv_result_name"
        android:layout_toRightOf="@id/tv_tags"
        android:layout_toLeftOf="@id/right_ll"
        android:layout_marginLeft="@dimen/default_margin"
        android:layout_marginBottom="@dimen/default_margin" />

    <LinearLayout
        android:id="@id/right_ll"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:orientation="vertical">

        <TextView
            android:id="@+id/tv_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/default_margin" />

        <Space
            android:id="@+id/filler_space_price"
            android:layout_width="1dp"
            android:layout_height="1dp"
            android:layout_marginLeft="@dimen/default_margin"
            android:layout_marginBottom="@dimen/default_margin"
            android:layout_marginRight="@dimen/default_margin" />

        <ImageButton
            android:id="@+id/btn_tags"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:src="@android:drawable/ic_menu_manage"
            android:contentDescription="@string/button_tags_content_description"
            android:background="@layout/transparent_background"
            android:layout_marginLeft="@dimen/default_margin"
            android:layout_marginBottom="@dimen/default_margin"
            android:layout_marginRight="@dimen/default_margin" />

    </LinearLayout>

</RelativeLayout>

我还遇到了一些问题,即 getView 被多次调用,而不是在创建时仅调用一次,但这对于另一个问题 https://stackoverflow.com/questions/24904484/android-listview-called-too-many-times-or-changes-order-how-to-prevent-both/24905156#24905156.


我想这就是你所期待的。尝试布局并调整它以满足您的需求:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- Left side -->

    <LinearLayout
        android:id="@+id/leftContainer"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/image1"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:background="@android:color/white" />

        <View
            android:id="@+id/space9left"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_below="@+id/image1" />
    </LinearLayout>

    <TextView
        android:id="@+id/textview2"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:layout_toLeftOf="@+id/rightContainer"
        android:layout_toRightOf="@+id/leftContainer"
        android:text="Textview2" />

    <EditText
        android:id="@+id/edittext4"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:layout_below="@+id/textview2"
        android:layout_toRightOf="@+id/leftContainer"
        android:text="Edittext4" />

    <TextView
        android:id="@+id/autocompleteTextview5"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:layout_toLeftOf="@+id/rightContainer"
        android:layout_toRightOf="@+id/edittext4"
        android:layout_below="@+id/textview2"
        android:text="autocompleteTextview5" />

    <TextView
        android:id="@+id/textview6"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:layout_below="@+id/edittext4"
        android:layout_toRightOf="@+id/leftContainer"
        android:text="Textview6" />

    <TextView
        android:id="@+id/spinner7"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:layout_below="@+id/autocompleteTextview5"
        android:layout_toRightOf="@+id/textview6"
        android:layout_toLeftOf="@+id/rightContainer"
        android:text="Spinner7" />

    <!-- Right side -->
    <LinearLayout
        android:id="@+id/rightContainer"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/textview3"
            android:layout_width="wrap_content"
            android:layout_height="50dp"
            android:text="Textview3" />

        <View
            android:id="@+id/space9right"
            android:layout_width="wrap_content"
            android:layout_height="50dp"
            android:layout_below="@+id/image1" />

        <ImageView
            android:id="@+id/image8"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:background="@android:color/white" />
    </LinearLayout>

</RelativeLayout>

希望能帮助到你。

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

将多个嵌套的 LineairLayout 转换为单个relativelayout 的相关文章

  • Paypal 支付页面布局在 webview android 中损坏

    我在某些 Android 设备上遇到一个奇怪的问题 我正在 webview 上打开 PayPal 支付页面 但它的布局在某些设备上被破坏 请任何人有任何想法 请提出建议 我被困住了 该截图设备的浏览器为chrome版本34 0 1847 1
  • 在 Sql Server 中启用 DTD 支持

    我有各种 xml 文档需要存储在数据库列中 这些文档包含对 DTD 的引用 并且 SQL Server 不会导入 xml 因为它存在安全风险 如何在数据库上启用 DTD 支持 以便它可以让我插入 xml 内容 你必须CONVERT首先 MS
  • 具有待处理意图的警报管理器

    下面的代码片段 public void onCreate Bundle savedInstanceState super onCreate savedInstanceState setContentView R layout main Do
  • 使用 xsd.exe 工具从具有多个命名空间的 XML 文件生成 XSD 文件

    我想做的事 我正在尝试为现有 XML 文件生成 XSD 文件 我正在使用xsd exe工具 随 Visual Studio 一起提供 XML 文件中的某些元素是命名空间限定的 在某些情况下 本地名称是相同的 如下所示
  • Robolectric 3.0 不适用于 AppCompat 21+

    升级到 AppCompat 21 后 我们的许多 Robolectric 测试都失败了 Toolbar 和 AppCompatDelegate 似乎存在问题 我尝试了 support v4 appcompat 22 2 1 和 appcom
  • Eclipse 说“更新 Android Developer Toolkit”

    我不知何故弄乱了我的 Eclipse 和 Android 设置 我不知道如何修复它 问题症状如下 在 首选项 gt Android 中 我尝试选择 android sdk linux 的位置 选择时出现错误 此 Android SDK 需要
  • 如何使用抽屉布局左侧移动主要内容

    刚刚检查了如何使用 DrawerLayout 制作菜单here http www androidhive info 2013 11 android sliding menu using navigation drawer 但左侧菜单正在移动
  • Android 背景 + 文本 + 按钮图标

    我想要一个图像设置为文本的背景 并在文本的左侧设置一个图标 在iPhone中非常简单 但不知道如何在Android上做到这一点 调整按钮的大小并保持图标 文本的位置和距离正确 iPhone 安卓我有这个 xml代码是
  • Android 应用程序阿拉伯语支持

    我已经按照developer android官方网站上的教程Hello L10进行操作 但没有任何关于阿拉伯语的内容 Android 应用程序要使用阿拉伯语需要执行哪些步骤 例如 用户可以使用组合框或单选按钮来选择英语或阿拉伯语 我已经这样
  • React Native 图像选择器图像上传在 iOS 上不起作用

    我在通过 fetch 和 react native image picker 将图像上传到 Multer 和 Express 后端时遇到问题 下面是我的 React Native 代码 try const data new FormData
  • Apache POI 的 ProGuard 设置

    我正在构建一个使用 Apache POI 库的应用程序 当我调试应用程序 在不运行 Proguard 的情况下编译它 时 一切都运行良好 但是在导出 APK 后 当我运行应用程序并打开 Excel 文件时 出现以下异常 RuntimeExc
  • android listactivity onCheckedChangeListener

    我正在开发一款应用程序 并且我有一个ListActivity 其选择模式设置为choice mode multiple 现在我想重写方法 当一项被调用时调用该方法选中 未选中 我发现onCheckChanged 方法仅针对RadioGrou
  • NestedScrollView 中带有 RecyclerView 的 ItemTouchHelper:拖动滚动不起作用

    我已经实现了 ItemTouchHelper 如本文所述 https medium com ipaulpro drag and swipe with recyclerview b9456d2b1aaf k7xm7amxi https med
  • 使用react-native使用WebView设置用户代理

    我想修改 WebView 中的用户代理字符串 以便在服务器端我可以检测到请求来自我的反应本机应用程序 我想使用 WebView 中的 source 属性来做到这一点 对于 IOS 和 Android 我该如何执行此操作 您只需将其设置为 W
  • 电子邮件发不出去,短信中的链接为 404

    我们刚刚完成将 Google AppInvites 集成到我们的应用程序中 我们注意到以下问题 电子邮件不会被发送 而发送的短信会带有一个链接 显示会出现 404 页面 仅当我设置 设置其他平台目标应用程序 对于 Android 和 iOS
  • 如何等待 Kotlin 协程完成

    我读过几十篇文章 但不知何故 没有一个答案似乎适用于我的情况 我想要实现的是在Fragment中等待ViewModel使用Room执行操作 Dao Query SELECT FROM my table WHERE id id suspend
  • recyclerview 未连接适配器;跳过布局

    刚刚实施RecyclerView在我的代码中 替换ListView 一切正常 显示数据 但正在记录错误消息 15 25 53 476 E RecyclerView No adapter attached skipping layout 15
  • 是否可以从 Android Studio 恢复被覆盖的文件?

    由于错误 我覆盖了我的两个来自 android studio 的具有相同名称的项目 并且今天我已经取消了该操作 我尝试打开主项目 但发现其中没有 Java 类 只有布局文件 在我覆盖的第二个项目中 文件存在巨大混乱 并尝试使用 Androi
  • 在没有 ActionBarSherlock 的情况下更改 SearchView 中的光标颜色

    我正在尝试更改 ICS 中 SearchView 小部件上闪烁光标的颜色 我已经尝试过以下方法 Adding
  • 如何获取 EC2 实例的 CloudWatch 指标数据

    我想获取我的 EC2 实例的 Cloudmetrics 数据 以便我可以使用这些数据绘制图表并将其显示在我的 Android 设备上 我怎么做 有相同的示例程序或教程吗 提前致谢 这就是我正在做的 private static void f

随机推荐

  • 在 PHP 中,如何找到一个数组中不在另一个数组中的元素?

    有没有一个类似于 array merge 的 php 函数 其作用完全相反 换句话说 我有两个数组 我想从第一个数组中删除第二个数组中存在的任何值 我可以通过循环迭代来做到这一点 但如果有一个方便的函数可以做同样的事情 那将是首选 Exam
  • JSF 2.0 在 commandLink 和 commandButton 上导航不起作用

    我正在使用 JSF 2 0 并且在 commandLink 和 commandButton 之后的导航时遇到问题 我使用以下代码
  • 将用户输入设置为变量名称[重复]

    这个问题在这里已经有答案了 我正在使用 python 想知道是否可以向用户询问变量的名称 然后使用该名称创建一个变量 例如 my name input Enter a variable name for example the user c
  • 如何获取所有已打开的子窗口的引用

    我想获取所有已打开的子窗口的引用 有什么办法吗 我没有使用child window open 只是使用window open 并打开多个子窗口 如果您不想更改当前代码 只需覆盖即可window open 功能 var openedWindo
  • 带有 magrittr tee 运算符的多个 ggplots

    我试图找出为什么当我将数据传递给 ggplot 命令时 tee 运算符 T gt 不起作用 这很好用 library ggplot2 library dplyr library magrittr mtcars T gt qplot x cy
  • 为什么我能够从本地主机上传到 AWS S3,但不能从 AWS Elastic BeanStalk 实例上传到 AWS S3?

    我正在使用 AWS Credentials 连接到我的 AWS S3 final AmazonS3 s3 new AmazonS3Client new AWSStaticCredentialsProvider new BasicAWSCre
  • 加速度计数据:如何解读?

    我正在试验 3 个加速度计分线板 X和Y轴非常容易控制 但Z轴有点神秘 我正在尝试找到一种解释代码中数据的方法 以在设备在空中升起时增加输出 并在设备下降时减少输出 这可能吗 如果是这样 怎么办 也许如果有人能给我指出一个好的参考来源会有帮
  • 循环遍历 numpy 数组中的每个项目?

    我正在尝试访问 numpy 二维数组中的每个项目 我习惯了 Python 中类似的东西 for row in data for col in data print data row col 但现在 我有一个data array np arr
  • 需要将 MS Visual C++ 移植到 Linux G++

    首先我想说我是一名计算生物物理学家 而不是软件工程师 所以我的编程知识仅限于科学计算 我使用 C Matlab 和 R 最近 我被要求将一个巨大的代码包 约 10 000 行 从 MS Visual C 移植到 Linux 我一直在其中开发
  • 以 Jenkins 用户身份部署或允许 Jenkins 以不同用户身份运行?

    我刚刚开始使用 Jenkins CI 有一个问题 努力在文档或在线中寻找答案 想知道是否 有人可以提供一些建议吗 我正在尝试使用它来自动部署我的开发和阶段 我的 Django 项目的分支托管在 Github 上 组织存储库 即私有 目前我有
  • 尝试将 pdfstamper 中的内存流获取到 pdfreader 中,但得到:“未找到 PDF startxref”

    我正在用 C 编写一个应用程序 它填充一堆 pdf 表单 将它们连接起来 然后放入一些页码 我在处理 pdfstamper 的内存流结果时遇到困难 如果我将内存流更改为文件流 它可以正常工作 但我不想使用文件系统 我创建了以下代码片段来重现
  • 添加 Twitter 组件时出现错误且网站无法加载

    在添加 Twitter 组件时 我得到了Uncaught ReferenceError process is not defined在我的 React Hooks Web 应用程序中 有人可以就这个问题提出建议吗 我尝试在下面添加windo
  • 如何使用直接流在Kafka Spark Streaming中指定消费者组

    如何使用直接流 API 为 kafka Spark 流指定消费者组 ID HashMap
  • 以编程方式禁用和启用 Android 中 Activity 的方向更改

    我有一个应用程序可以做一些后台人员 当后台工作正在运行时 会显示进度圈 如果设备在此期间旋转 则活动将 重置 我想避免这种情况 因此 我决定在此过程中禁用定向 我已经看到了这个问题的不同线程 但没有一个有效的解决方案 至少在我的情况下是这样
  • 使用 Room 进行动态排序

    我想使用 room 创建一个动态查询 以便在一种情况下查询返回特定的订单类型 并且在运行时如果订单类型发生更改 则会创建一个新查询 并根据此类型按顺序返回数据 我正在使用 Room 返回 DataSource Factory 对象 我正在使
  • 可存储向量和未装箱向量之间的差异

    所以 我使用了未装箱的向量 来自vector包 最好现在就不用考虑太多 vector th unbox让为它们创建实例变得轻而易举 所以为什么不呢 现在我遇到了一个实例 我无法自动派生这些实例 这是一种带有幻像类型参数的数据类型 如Vect
  • 如何使图像 100% 适合大屏幕

    我有以下 HTML div class jumbotron div class container h1 Souplesse h1 p Be a Good Sport p div div 以及以下 CSS jumbotron backgro
  • 精灵的对角线运动

    如何实现精灵的对角线移动 我创建了一个可移动的精灵 一个矩形 它向四个方向移动 为了使矩形具有动画效果 使用了计时器对象和动作执行方法 我在 keyPressed 和 keyReleased 方法中实现了以下代码 以将其向四个方向移动 pu
  • 优化代码以最小化宏的运行时间

    我一直在编写一些宏来执行一些占星计算 计算星座 月亮宫 D9 和 D60 原始数据的格式如下 上图中的lng代表经度 以度 分 秒的格式表示 输出必须采用以下格式 我编写了以下代码来从输入表中读取数据并格式化并将其复制到输出表中 然后使用每
  • 将多个嵌套的 LineairLayout 转换为单个relativelayout

    首先 我总体上对用户界面很不好 这就是为什么我需要一些帮助 现在我有以下内容 Explained with a Paint picture Actual Screenshot of what I currently have 代码可以在这篇