1

ドメイン モデルのリストを表示するアプリケーションを作成しています。デフォルトの動作では、これらのモデルはListView. ユーザーがこのデータをリストとして表示するか、GridView. そうするための慣用的な方法は何ですか?

私のドメイン モデルは単純な pojo です。そのCustomArrayAdapterための と、現在次のようなカスタム行レイアウトを作成しました。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@+id/label" >
    </TextView>

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="25dp"
        android:layout_toRightOf="@+id/label"
        android:text="@+id/text" />

</RelativeLayout> 

ArrayAdapter両方のレイアウトに同じものを使用したいと考えています。

私の活動のレイアウトはかなり単純です:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_vertical"
    tools:context=".MainActivity" >

    <!-- what do I put here? -->

</RelativeLayout>
4

2 に答える 2

5

常にグリッドビューを使用して、列を「ListView」モードの列に設定しないのはなぜですか

android:numColumnsまたはsetNumColumns(int)コードを介して?

詳細: http://developer.android.com/reference/android/widget/GridView.html

于 2013-05-01T18:07:54.013 に答える