0

複数列のリスト ビューを使用してデータをグリッドのように表示しますが、ユーザー定義の列と境界線のある行を含むリスト ビューが必要です。提案?

main.xml

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

<ListView
    android:id="@+id/listView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>

 </LinearLayout>

main1.xml

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout android:orientation="horizontal" 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android">

<TextView
    android:id="@+id/cust"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:text="customer" />

<TextView
    android:id="@+id/order"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:text="order" />

<TextView
    android:id="@+id/freight"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:text="freight" />

<TextView
    android:id="@+id/station"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:text="station" />

</LinearLayout>
4

1 に答える 1

0

方法 1 :

1)カスタム アダプターを実装する

2)getview()メソッドで、ビューを返す前に背景を ( borderで) ビューに設定します。

方法 2:

使用するArrayAdapter

TextView1)背景(境界線がある)を含むxmlファイルを作成します

2) この xml への参照をArrayAdapter

私が何について話しているのかわからない場合のために、ここにチュートリアルがあります。

于 2012-09-07T04:48:22.023 に答える