Android 将ListView布局更改为单元格布局

Android 将ListView布局更改为单元格布局,android,android-layout,listview,catalog,xmlcatalog,Android,Android Layout,Listview,Catalog,Xmlcatalog,我的Android应用程序中有一个列表视图。ListView应该是一个项目目录。现在,它看起来不像catalog,因为它显示为行列表 有没有一种方法可以创建一个具有3个垂直行和与目录中项目数相同数量的水平行的表视图,并且仍然使用与我在列表视图中使用的数据相同的数据?另外,如何更改要显示为矩形单元格的单元格布局 CellLayout.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android=

我的Android应用程序中有一个
列表视图
ListView
应该是一个项目目录。现在,它看起来不像catalog,因为它显示为行列表

有没有一种方法可以创建一个具有3个垂直行和与目录中项目数相同数量的水平行的表视图,并且仍然使用与我在
列表视图中使用的数据相同的数据?另外,如何更改要显示为矩形单元格的单元格布局

CellLayout.xml:

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

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/itemNameList"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/itemPriceList"
    android:layout_below="@+id/itemNameList"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"/>

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/itemImageList"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />


我用一种非常简单的方法解决了这个问题:我刚刚将
列表视图的类型更改为
GridView
,并修复了单元格布局,因此它将垂直显示,而不是水平显示。

非常确定您想要一个带有GridLayoutManager的GridView或RecyclerView。ListView将只执行单个项目的垂直堆栈。是的,但是如何更改它,并且仍然使用我的
BaseAdapter