カスタムアダプタクラスを使用せずに、ImageViewとTextViewで構成される単純なリストを作成しました。インターネットを調べたところ、ほとんどのカスタムリストが個別のアダプタクラスを使用して作成されていることがわかりました...リスト行のレイアウトは次のとおりです...
list_row.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
android:layout_marginRight="15dp"/>
<TextView android:id="@+id/list_item_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="15dp"
android:textSize="15sp"/>
</LinearLayout>
MainActivity.java
//Taking reference of a ListView
ListView listView = (ListView) findViewById(R.id.list_view);
//Setting up ArrayList to feed ArrayAdapter
ArrayList<String> fruits= new ArrayList<String>();
fruits.add("Apple");
fruits.add("Mango");
fruits.add("Strawberries");
fruits.add("Grapes");
//Setting up ArrayAdapter
ArrayAdapter<String> adapter = new ArrayAdapter<String>
(this, R.layout.list_row, R.id.list_item_id, fruits);
listView.setAdapter(adapter);
上記のコードは正常に機能しています...個別のAdapterクラスをいつ作成するのか、そしてそれをどのように使用するのかを知りたいだけです。言い換えると、個別のAdapterクラスを作成する利点は何ですか?どんな助けでもありがたいです...事前に感謝します...