1. 程式人生 > >Android ListView分兩列顯示(不用自定義Adapter)

Android ListView分兩列顯示(不用自定義Adapter)

<?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"
    android:padding="@dimen/dialog">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="@string/cc"
            android:textColor="@color/green" />

        <TextView
            android:id="@+id/text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="@string/area"
            android:textColor="@color/green" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:baselineAligned="true"
        android:orientation="horizontal">
        <!--android:baselineAligned="false"-->


        <ListView
            android:id="@+id/list1"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

    </LinearLayout>


</LinearLayout>

3、將資料和listView繫結