Android 有没有办法制作这个自定义列表?

Android 有没有办法制作这个自定义列表?,android,custom-lists,Android,Custom Lists,是否有任何可能的方法来实现android自定义listview,如下图所示? 自定义适配器应具有另一个listview,如下所示 提前谢谢 activity_main.xml <LinearLayout android:id = "@+id/relativeLayout1" android:layout_width = "fill_parent" android:layout_height = "wrap_content" > <TextVie

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

提前谢谢

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>

如我所见,上图中的行大小不相等。如果你的计划是以友好的方式建立列表项,那么你可以自己创建它,但这可能是一项相对较大的任务(“重新发明轮子”,如果你知道我的意思的话)。在这里你可以找到一个主题,当你必须在 ListVIEW/COD>或 TabelayayOut/<代码>之间进行选择时,这可以是另一种解决方案:

我的拙见是:因为我们在你的图片上看到的是一张表,而不是一张列表,所以应该用TableLayout来制作

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


这是另一个小部件,或者它通过使用具有多个“列”和可能的行的自定义单元格来模拟表。您可以使用TableLayout而不是自定义listview。我的对象是具有列表的每个类别。那么为什么我需要使用listview和textview这两种视图呢?你能编辑一下答案吗?看看这个例子,希望能对你有所帮助