私はアンドロイドの初心者です。
私はこのように見なければならないリストを持っています:PIC NAME DESC
上記の3つの情報すべてを含むバケットのリストがあります。問題は、ビューに表示できるフィールドは1つだけです。この場合、bucket.getBucketName()です。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Bucket> buckets = BucketHandler.getBucketList();
List<String> bucketList = new ArrayList<String>();
for (Bucket bucket : buckets){
bucketList.add(bucket.getBucketName());
}
setListAdapter(new ArrayAdapter<String>(this, R.layout.row,
R.id.bucket_list, bucketList));
}
MY.xmlは次のとおりです。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
<TextView
android:id="@id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/noData"/>
</LinearLayout>
行レイアウト:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/lightgray">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/none"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/bucket_list"
android:layout_width="210dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"/>
<TextView
android:id="@+id/bucket_percentage"
android:layout_marginTop="15dp"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
/>
<TextView
android:id="@id/android:hidden_id"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
/>
</LinearLayout>
アイテムリスト内の3つのフィールドすべてをレンダリングするにはどうすればよいですか?ありがとうございました。