有什么方法可以制作这个自定义列表吗?

Is there any possible way to make this custom list?

是否有任何可能的方法来实现 android 自定义列表视图,如下图所示? 自定义适配器应该有另一个列表视图,如下所示。

提前致谢。

activity_main.xml

<LinearLayout
    android:id = "@+id/relativeLayout1"
    android:layout_width = "fill_parent"
    android:layout_height = "wrap_content" >

    <TextView
        android:layout_width = "0dp"
        android:layout_height = "wrap_content"
        android:layout_weight = "2"
        android:gravity = "center"
        android:padding = "5dp"
        android:text = "Firt column title"
        android:textColor = "#ffffff"/ >

    <TextView
        android:layout_width = "0dp"
        android:layout_height = "wrap_content"
        android:layout_weight = "1.5"
        android:gravity = "center"
        android:padding = "5dp"
        android:text = "Second column title"
        android:textColor = "#ffffff" />

    <TextView
        android:layout_width = "0dp"
        android:layout_height = "wrap_content"
        android:layout_weight = "1"
        android:gravity = "center"
        android:padding = "5dp"
        android:text = "third column title"
        android:textColor = "#ffffff" />
</LinearLayout>

<ListView
    android:id = "@+id/listview"
    android:layout_width = "match_parent"
    android:layout_height = "wrap_content"
    android:divider = "@null"/>

cell_shape.xml

<layer-list xmlns:android = "http://schemas.android.com/apk/res/android">

<item
    android:left = "-2dp"
    android:top = "-2dp">
    <shape android:shape = "rectangle" >
        <solid android:color = "@android:color/transparent" />

        <stroke
            android:width = "1dp"
            android:color = "@color/colorCell" />
    </shape>
</item>

listview_row.xml

<LinearLayout
    android:id = "@+id/relativeLayout1"
    android:layout_width = "fill_parent"
    android:layout_height = "wrap_content"
    android:background = "@color/colorCell" >

    <TextView       
        android:id = "@+id/sNo"      
        android:layout_width = "0dp"
        android:layout_height = "match_parent"
        android:layout_weight = "1"
        android:background = "@drawable/cell_shape"
        android:ellipsize = "end"
        android:padding = "5dp"
        android:text = "categorie"
        android:singleLine = "true" />

<ListView
    android:id = "@+id/listview_first section list"
    android:layout_width = "match_parent"
    android:layout_height = "wrap_content"
    android:divider = "@null"/>
<ListView
    android:id = "@+id/listview_number_section_list"
    android:layout_width = "match_parent"
    android:layout_height = "wrap_content"
    android:divider = "@null"/>


</LinearLayout>

如我所见,上图中的行大小不等。如果您的计划是动态地构建列表项,则可以自己创建它,但这可能是一项相对较大的任务("re-inventing the wheel",如果您明白我的意思)。 Here你可以找到一个关于当你必须在ListViewTableLayout之间做出选择时应该考虑的问题的SO主题,这可以是另一种解决方案:

ListView or TableLayout?

依我愚见:因为我们在您的图片上看到的是 table 而 而不是 列表,它应该用 TableLayout 制作。

如果你也这么认为,这里是 TableLayout 的官方教程指南... ;)

https://developer.android.com/guide/topics/ui/layout/grid.html