如何在android中的listview中添加listview?

2024-04-26

我在列表视图项目中添加为 3 个文本视图,我想用 3 个文本视图和列表视图显示列表视图项目。我正在这样做......

  <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/seating_people_sno_txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="10dp"
            android:text="Sno"
            android:textColor="#e73e97"
            android:textSize="20sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/seating_tname_txt"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="10dp"
            android:maxLines="2"
            android:text="Table Name"
            android:textColor="#e73e97"
            android:textSize="20sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/seating_seats_txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="15dp"
            android:text="Seating"
            android:textColor="#e73e97"
            android:textSize="20sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/seating_seated_txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="25dp"
            android:text="Seated"
            android:textColor="#e73e97"
            android:textSize="20sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/seating_add_txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="25dp"
            android:text="Add"
            android:textColor="#e73e97"
            android:textSize="20sp"
            android:textStyle="bold" />
    </LinearLayout>

    <View
        android:layout_width="fill_parent"
        android:layout_height="2dip"
        android:layout_marginTop="7dp"
        android:background="#c6c6c6" />

    <ListView
        android:id="@+id/seatingchart_list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:divider="#c6c6c6"
        android:dividerHeight="2dp" >

在这些 xml 包含 listview 的 listview 中,我添加了一个 xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/seatingparentlist_sno"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:paddingBottom="20dp"
        android:paddingTop="20dp"
        android:textSize="20sp"
        android:textColor="#595959" />

    <TextView
        android:id="@+id/seatingparentlist_tablename"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:layout_toRightOf="@+id/seatingparentlist_sno"
        android:paddingBottom="20dp"
        android:paddingTop="20dp"
        android:textSize="20sp"
        android:textColor="#595959" />

    <TextView
        android:id="@+id/seatingparentlist_seating"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="40dp"
        android:layout_toRightOf="@+id/seatingparentlist_tablename"
        android:paddingBottom="20dp"
        android:paddingTop="20dp"
        android:textSize="20sp"
        android:textColor="#595959" />

    <TextView
        android:id="@+id/seatingparentlist_seated"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="25dp"
        android:layout_toRightOf="@+id/seatingparentlist_seating"
        android:paddingBottom="20dp"
        android:paddingTop="20dp"
        android:textSize="20sp"
        android:textColor="#595959" />

    <ImageView
        android:id="@+id/seatingparentlist_addbtn"
        android:layout_width="40dp"
        android:layout_height="40dp"
         android:paddingTop="20dp"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@+id/seatingparentlist_seated"
/>
</RelativeLayout>
<ScrollView android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
     xmlns:android="http://schemas.android.com/apk/res/android" >
<ListView android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
       android:divider="#c6c6c6"
            android:dividerHeight="2dp"
    android:id="@+id/seatingparentlist_list">
</ListView>
</ScrollView>
</LinearLayout>

        </ListView>
    </LinearLayout>

我在这些 xml 中又使用了一个列表视图 对于这些列表视图,我在这些列表视图中又使用了一个 xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="60dp"
    android:orientation="horizontal">
      <TextView
            android:id="@+id/detailseating_list_peoplename"
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:textColor="#595959"
            android:text="sai.."
            android:textSize="20sp"
            android:layout_gravity="center"
            android:textStyle="bold" />
        <TextView
            android:id="@+id/detailseating_list_brideorgroom"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:textColor="#595959"
            android:text="sai.."
            android:textSize="20sp"
            android:layout_gravity="center"
            android:textStyle="bold" /> 

       <ImageView
            android:id="@+id/detailseating_list_rsvp_img"
            android:layout_width="25dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="05dp"
            android:textColor="#595959"
            android:textSize="20sp"
            android:src="@drawable/cancelicon"
            android:layout_gravity="center"
            android:textStyle="bold" /> 
    </LinearLayout>

这些必须我在单一活动中使用如果有任何想法请帮助我


所有你需要的是可扩展的列表视图 http://developer.android.com/reference/android/widget/ExpandableListView.html

他们还在 API 演示中给出了一个示例。

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

如何在android中的listview中添加listview? 的相关文章

  • 如何在点击时从 webview 获取 URL

    我怎样才能获得 点击的URL webview在其点击事件上 Override public void onClick View v if v getId R id webview Here i want to get clicked url
  • 如何在GreenDao中实现表继承

    我一直在尝试创建一个数据库 其中所有表都继承某个元素 以便有可能拥有元数据 我在模型生成器的所有表声明中添加了这一行 public Entity addSuperEntity Schema schema Entity superEntity
  • CursorAdapter 破坏了 CHOICE_MODE_MULTIPLE 选项

    我有一个ListFragment 我在其中添加一个CursorAdapter to my ListView 并且我希望能够单击几行以使用上下文操作栏 我使用 SherlockActionbar 当我使用一个简单的ArrayAdapter 但
  • 支持多屏幕[关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 支持多个屏幕和不同的屏幕密度必须注意
  • Glide:如何使用 Glide v4 调整 gif 大小并将其另存为文件?

    我想调整 gif 文件的大小并保存它 我尝试使用一些建议的方法 但这些方法给出了错误 后来我知道有些方法在 Glide 中已被弃用v4 byte bytes Glide with context asGif load url toBytes
  • 如何将数据从 SQLITE 数据库获取到 Android 中的数组?

    很确定这是一个简单的问题 但我对所有将从游标返回的数据适应不同视图的示例感到困惑 我只想运行原始查询并将返回的每一项数据放入浮点数组中 以便我稍后可以将它们添加起来 我需要为此使用什么 Thanks 当您查询数据库时 您仍然会有一个游标 但
  • 如何转到材料日历视图中选定的日期?

    我在用着材料日历视图 https github com prolificinteractive material calendarview在我的项目中 我可以使用 setSelectedDate 方法更改日期的选择 我有一个 今天选择 按钮
  • PreferenceActivity 如何使用自定义首选项文件

    我第一次尝试偏好是在不了解PreferenceActivity 所以现在我有一个应用程序将所有用户首选项存储在特定的首选项文件中 我想迁移到使用 PreferenceActivity 但我也希望我的用户保留他们的偏好 有没有办法告诉我的 P
  • 使用 Android Intent 发送基于 HTML 的电子邮件正文

    我需要使用 android Intent extra 将基于 HTML 的内容发送到电子邮件应用程序 它接受一些标签 例如 br 但它没有显示任何锚链接或 h1 其显示像简单的文本 EDITED I have tried with gmai
  • 应用程序在 JSON jparser 发出 http 请求时崩溃

    您好 我使用本教程连接到网络或本地的 mySQL 数据库 here http www androidhive info 2012 05 how to connect android with php mysql 虽然所有服务器端 php 文
  • 调用replace()方法后片段闪烁/闪烁

    我有一个MainActivity 应该在两个片段之间切换 内容和设置 扩展PreferenceFragmentCompat 一切工作正常 但最近我实施了Dagger 2依赖注入 我的设置片段开始闪烁 当您按下底部导航栏上的设置项时 有时会出
  • SignalR 与 android(Java) 有问题

    我想在 android 应用程序和 net core 服务器项目之间进行实时通信 我在 stackoverflow 中尝试了一个问题 我跟着这个one https stackoverflow com questions 32573823 h
  • 如何检查Android应用程序是否第一次打开

    我想在用户第一次打开应用程序时有一个弹出窗口 如何查看 获取应用程序被打开的次数 请帮忙 多谢 当您的应用程序启动时 在onCreate 方法 您可以检查 SharedPreference 是否存在 如果没有 则这是该应用程序第一次启动 然
  • android应用程序在模拟器上运行但在手机上运行

    我有我开发的这个应用程序 它在模拟器上运行得很好 没有任何错误 但当我尝试在手机上运行相同的代码进行测试时 应用程序崩溃并提示 filenotfoundexception 它说文件 res drawable divider horizo n
  • Android 是否可以同时使用前后摄像头[重复]

    这个问题在这里已经有答案了 我想同时使用设备的前置和后置摄像头 在我的应用程序中 屏幕的前半部分将显示后置摄像头的预览 屏幕的下半部分将显示前置摄像头的预览 我尝试过设置两个不同的相机预览 但是当我打开应用程序时 屏幕的前半部分 显示后置相
  • 在 Android 应用程序中编辑/添加 IPTC 元数据

    我看过许多其他类似的问题 但似乎没有一个有准确的答案 我正在开发一个可处理大量图像的 Android 应用程序 我希望通过编辑 IPTC 关键字标签 或其他适当标签 的值来向图像添加信息 我在用元数据提取器 http drewnoakes
  • Android - 减少位图绘制的内存使用量

    我的应用程序中有一张地图 显示了 Gowalla 的位置 我使用带有简单默认标记的 ItemizedOverlay 但在绘制项目时 我将默认标记替换为从 Gowalla 下载 9 并缓存在磁盘上 的位置图标 问题是 如果屏幕上有很多位置 例
  • GreenDao交易

    我在用着GreenDao存储大量数据 来自休息服务 我的很多实体都与关系相关 一切都很顺利 但明天我必须实施坚如磐石的工作流程 当我加载数据时我必须检查是否发生错误 如果是这样 我必须确保没有存储任何内容在 SQLite 数据库中 通常我会
  • Activity 在 Android 上创建两次

    首先 我是 Android 开发新手 所以请耐心等待 我将从用户界面开始 我有一个按钮 一旦您点击它 就会启动一个活动以获取结果 public class GUIActivity extends Activity Override publ
  • Pinterest 喜欢自定义 GridView

    我是 Android 新手 我正在寻找网格视图的逻辑 例如为 iPhone 构建的 pinterest homescreen 应用程序 一个大号 图像来自服务器 我需要以以下形式显示并具有分页效果 即在滚动上加载图像 如果可以的话请回复 我

随机推荐

  • 如何在树视图标题中“创建”和“导入”按钮 Odoo 8 附近添加按钮?

    我可以成功在表单视图标题或树视图行中添加按钮 但我想在 Odoo 8 中 创建 和 导入 按钮附近的树视图标题中添加自定义按钮 我该如何执行此操作 我找到了解决我的问题的方法 如果我使用 我会替换创建按钮project project mo
  • gnuplot 动画 2D 矢量场

    我正在尝试使用 gnuplot 制作 2D 矢量动画 我想显示一行 即一次显示一个向量 我的数据结构如下 它们x y u v 2 24448 0 270645 1 00 1 00 3 24448 0 270645 0 500 1 20 我可
  • android widget id 仅适用于当前widget

    我可以获取当前的 widgetId 吗onUpdate 的方法AppWidgetProvider 我发现很多关于发送的帖子appWidgetId在意图字段中 但我不明白在发送之前我必须在哪里获取它 我没有找到在没有配置活动的情况下仅获取当前
  • 检查一个类是否派生自泛型类

    我的项目中有一个带有派生类的通用类 public class GenericClass
  • 我们可以在密钥库中加载多个证书和密钥吗?

    我们可以在密钥库中加载多个证书和密钥吗 是否始终需要仅加载对 即证书和密钥一起 如果密钥库有多个证书和密钥 当 Java SSL 尝试作为服务器建立连接时会选择哪一个 尽管这取决于 KeyStore 类型 但通常您可以在单个存储中存储多个私
  • 如何获取图标名称的完整文件路径?

    如何从 GNOME 中的图标名称获取完整文件路径 import gtk icon theme gtk icon theme get default icon info icon theme lookup icon my icon name
  • 使用 JavaScript 以编程方式更新 Google 电子表格?

    是否可以使用 JavaScript 从网页更新 Google 电子表格 设想 1 用户登陆网页 2 JS脚本执行 修改Google Spreadsheet 如何才能做到这一点 这是可能的 尽管我发现这很困难 请参阅此处了解所有详细信息 ht
  • AngularJs - 修改输入格式的指令

    我想做以下事情 我的控制器模型中有一个日期对象 我想让用户修改它 应为用户提供两个输入字段 第一个输入字段应修改日期 另一个输入字段应修改时间 两个输入字段应适用于相同的日期模型
  • UIImage 来自 NSString 中保存的字节

    我正在尝试从实际上保存在 NSString 中的字节数组创建 UIImage 有人可以告诉我该怎么做吗 这是我想做的事情 NSString sourceString mYActualBytesAREinHERe get the bytes
  • 开始/停止图像视图旋转动画

    我有一个开始 停止按钮和一个我想要旋转的图像视图 当我按下按钮时 我希望图像开始旋转 当我再次按下按钮时 图像应该停止旋转 我目前正在使用UIView动画 但我还没有找到停止视图动画的方法 我希望图像旋转 但是当动画停止时 图像不应返回到起
  • Rubberduck UI 子菜单被禁用

    我刚刚在 Windows 10 操作系统上安装了 Rubberduck VBE 插件 v2 0 11 2453 MSIL 当我在 Excel 中打开启用宏的 Excel 工作簿并启动 VBA 编辑器时 Rubberduck 启动 但 Rub
  • Android:尝试在空对象引用上调用虚拟方法“void android.widget.ListView.setAdapter(android.widget.ListAdapter)”

    我正在尝试创建一个列表视图 其中包含另一个活动中的图片和文本 我不太专注于android编程 所以基本上就像android编程的新手一样 我在调试我的应用程序时遇到困难 请帮我 Error Caused by java lang NullP
  • CUDA 估计 2D 网格数据的每块线程数和块数

    首先我要说的是 我已经仔细阅读了所有类似的问题 确定每个块的线程和每个网格的块 https stackoverflow com questions 4391162 cuda determining threads per block blo
  • Objective C - 音频延迟估计的互相关

    我想知道是否有人知道如何执行互相关两个音频信号之间iOS 我想将接收器 我正在从麦克风接收信号 处获得的 FFT 窗口与发射器处 正在播放音轨 处的 FFT 窗口对齐 即确保每个窗口的第一个样本 除了发射机的 同步 周期之外 也将是接收机的
  • wxPython 上的 IPython

    我一直在尝试找到一种方法 让 IPython Shell 能够在wx Frame 在库代码或 Google 中搜索 基于 wxPython 的 IPython 小部件 https www google com search q wxPyth
  • Three.js:基于图像的光照(IBL)

    I m searching to add an IBL to my scene and objects But I can t find anything on the web There are some examples with an
  • 将级联输入与 JasperReports JasperServer 4.0 的 API/Web 服务结合使用

    快速前言 我的公司实际上正在支付 Jasper 支持费用 但他们一直无法帮助我 此时 通过谷歌搜索答案只会让我找到他们网站上我自己的未答复的论坛主题 我快疯了 我在编写代码来使用 Jasper 的 Web 服务 API 处理级联输入时遇到了
  • 如何在Python中像Flask一样使用Klein接收上传的文件

    在搭建Flask服务器时 我们可以尝试接收用户上传的文件 imagefile flask request files imagefile filename str datetime datetime now replace werkzeug
  • 从 Bash 调用的 Expect 脚本的退出状态代码

    我制作了一个 Bash 脚本 它使用 Expect 脚本来自动进行 ssh 登录 该脚本连接到多个服务器并运行一些命令 bash 脚本会提示输入一次登录凭据 我想合并一个功能 其中如果第一个服务器登录失败 脚本将终止 以避免脚本检查下一个服
  • 如何在android中的listview中添加listview?

    我在列表视图项目中添加为 3 个文本视图 我想用 3 个文本视图和列表视图显示列表视图项目 我正在这样做