是possibe显示子视图水平扩展的ListView? [英] Is possibe displays child views in horizontally of expandable ListView?

查看:138
本文介绍了是possibe显示子视图水平扩展的ListView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的Andr​​oid开发者。
一般可扩展的ListView集团和子视图垂直显示。
但我想组视图显示在垂直方向而子视图水平显示。
子视图可能是3项。有可能的?如果可能?请帮我。

I am new android developer. Generally Expandable ListView Group and Child View shows vertically. But i wants Group View show vertically but Child Views shows horizontally. Child view may be 3 items. It is possible? If it is possible? Please help me.

推荐答案

我认为,你可以通过创建一个水平滚动型是你的孩子的项目解决这个问题,然后在此视图中可以添加任何你想要的孩子。

I think that you can handle this by creating a horizontal scrollview to be your child item, and then in this view you can add whatever children you want.

<HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="none">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/child1"
            android:textSize="15sp"/>
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/child2"
            android:textSize="12sp"/>
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/child3"
            android:textSize="10sp"/>
    </HorizontalScrollView>

假设你有最大的三个子项和您有与下面的架构的列表

Let's say that you are having maximum three child items and you are having a list with the following architecture

Parent
   child1 child2
Parent
   child1
Parent 
   child1 child2 child3

这时你应该有一个为每个父母只有一个孩子,项目适配器,并且您处理这些物品通过
  - 显示第一个父第三两种观点,为第二个视图和所有视图

Then you should have an adapter that have only one child item for each parent and you handle these items by - show two views for the first parent, one view for the second and all views for the third.

添加一些您的code,这样我可以告诉你在你的情况下,解决方案。

这篇关于是possibe显示子视图水平扩展的ListView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆