2017-01-08 7 views
0

私はListViewをAndroidアプリに持っています。 ListViewは商品カタログとされています。今は行リストとして表示されているので、カタログとよく似ていません。ListViewレイアウトをセルレイアウトに変更する

3つの垂直な行とカタログ内の項目数と同じ数の水平な行を持つテーブルビューを作成する方法はありますか?ListViewで使用しているのと同じデータを使用しますか?また、どのように矩形セルとして表示されるようにセルレイアウトを変更するには?

CellLayout.xml:私はちょうどGridViewListViewの種類を変更し、セルレイアウトを修正したので、それは次のようになります。

<?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" /> 

+0

GridLayoutManagerを持つGridViewまたはRecyclerViewを確実に使用してください。 ListViewは、アイテムの単一の垂直スタックを実行します。 – MCeley

+0

はい、どうすれば変更できますか、まだ私の 'BaseAdapter'を使用できますか? – Ido

答えて

0

私は非常に簡単な方法でそれを解決しました水平ではなく垂直に表示されます。

関連する問題