1

resultlookup.xml に次のコードがあります

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:id="@+id/layoutResultOuter"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:padding="5dp">
    <TextView
            android:id="@+id/txtResultLeadCode"
            style="@android:style/TextAppearance.Large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:text="ID" />
    <LinearLayout android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
        <TextView
                android:id="@+id/txtResultFirstName"
                style="@android:style/TextAppearance.Small"
                android:singleLine="true"  android:text="First Name" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>
        <TextView
                android:id="@+id/txtResultspace"
                style="@android:style/TextAppearance.Small"
                android:singleLine="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text=" " />
        <TextView
                android:id="@+id/txtResultLastName"
                style="@android:style/TextAppearance.Small"
                android:singleLine="true" android:text="Last Name" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
    </LinearLayout>
</LinearLayout>

ここで、このレイアウトをグリッド ビューで行の 1 つとして使用したいと考えています。グリッドは 1 列のグリッドです。

データは SQLite DB に保存されているので、データを取得してグリッド形式で表示する必要があります。

「View Inflater」または「Layout Inflater」を使用できる場所を読んでください。サンプルコードがあれば教えてください。

私はこのようなものが欲しい:

結果の画像

4

2 に答える 2

1

<include>タグは普通に使えると思います。方法は次のとおりです。

于 2012-02-17T11:25:34.043 に答える
0

カスタム アダプターを使用すると、独自のレイアウトを使用して GridView に項目を設定できます。

上記のレイアウトをアイテムとして使用し、 getView() メソッドでそれを膨らませると、正しく機能します..

これを一度確認してください:グリッドビューのカスタムアダプター

于 2012-02-17T11:23:25.153 に答える