Android创建列表列表

Android创建列表列表,android,Android,我正在开发一个应用程序,其中我需要创建一个列表列表。比如说 EmployeeGroup1组名、组ID、作业类型 雇员姓名、职务 雇员姓名、职务 雇员姓名、职务 雇员姓名、职务 EmployeeGroup2组名、组ID、作业类型 雇员姓名、职务 雇员姓名、职务 雇员姓名、职务 雇员姓名、职务 ... 等等 本例中的员工详细信息是从SQLite数据库检索的。员工组是固定的(5)。因此,我创建了5个相对布局组,并在每个“完成”窗口中放置了一个列表视图 <RelativeLayou

我正在开发一个应用程序,其中我需要创建一个列表列表。比如说

EmployeeGroup1组名、组ID、作业类型 雇员姓名、职务 雇员姓名、职务 雇员姓名、职务 雇员姓名、职务 EmployeeGroup2组名、组ID、作业类型 雇员姓名、职务 雇员姓名、职务 雇员姓名、职务 雇员姓名、职务 ... 等等

本例中的员工详细信息是从SQLite数据库检索的。员工组是固定的(5)。因此,我创建了5个相对布局组,并在每个“完成”窗口中放置了一个列表视图

        <RelativeLayout
        android:id="@+id/ltGroup1"          
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">   
           <TextView android:text="GroupName:" 
            android:id="@+id/lblGroupName_1" 
            android:layout_width="80dip" 
            android:layout_height="25dip"
            android:layout_alignParentLeft="true"
            android:textColor="@color/BLACK"
            android:textSize="14dip"      
            android:textStyle="bold"  
            android:paddingLeft="5dip"
            android:gravity="center" />  
            <TextView android:text="0 cal" 
            android:id="@+id/txtGroupName_1"
            android:layout_width="75dip" 
            android:layout_height="25dip"
            android:layout_toRightOf="@+id/lblGroupName_1"
            android:textColor="@color/TITLEBAR_TABS"
            android:textSize="13dip"    
            android:textStyle="bold"
            android:paddingRight="5dip"          
            android:gravity="right|center_vertical" />             
            <ListView android:id="@+id/lstEmployeeGroup_1"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:fadingEdge="none"               
             android:background="#ffffff"     
             android:scrollbars="none"
             android:divider="#ffcccccc"
             android:dividerHeight="1dip"
             android:layout_below="@+id/lblGroupName_1"/>                
        </RelativeLayout>  

如果我将所有相关的布局组放在一个LinerLayout中,然后在一个滚动视图中,员工列表只显示一个项目,要查看其他项目,我需要在单个列表中滚动。当屏幕已满时,scrollview开始滚动,然后我也无法滚动单个列表,这使情况变得更糟。
是否有一种方式可以让员工列表始终显示所有记录,而不是只显示一条

Listview无法显示所有记录,即使它设置为“填充父项高度”。当项目超过其显示时,它会自动滚动
您可以将每个列表的高度固定为特定的dp,以便它可以显示特定数量的记录。

现在解决了这个问题。曼尼什的线索帮助我把它弄对了。 ListView的高度需要使用LayoutParams属性设置为runtim。
我所做的是固定单个listitems的高度,并根据项目的数量计算运行时所有项目的总高度,并将该值设置为listview的高度。这为我做到了这一点。现在,列表会根据项目的数量调整其高度。

这可以工作,但它会显示固定数量的行。此外,如果行数超过了设置的高度,则您既看不到剩余的行,也无法在列表中滚动,因为滚动视图将代替列表移动。任何事情都可以在代码级别完成?