はい、もちろんですが、最初にArrayAdapter<>を拡張するクラスを作成する必要があります
このクラスは次のようになります。
public class Mylistcustom extends ArrayAdapter<String> {
private LayoutInflater mInflater;
private int mViewResourceId;
private String[] your_date;
public Mylistcustom(Context ctx, int viewResourceId, String[] data) {
super(ctx, viewResourceId,data);
this.contexto=ctx;
mInflater = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mViewResourceId = viewResourceId;
this.your_data=data;
@Override
public int getCount() {
return your_data.length;
}
@Override
public String getItem(int position) {
return your_data[position];
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
rowView = mInflater.inflate(mViewResourceId, null);// you are inflating your xml layout
text=(textView) rowView.findViewById(R.id.textView);//find a textview in your layout, of course you can add whatever you want such as ImaveView Buttons ....
text.setText(your_data[position]); // and set text from your_data
return rowView;
}}
リストビューアクティビティでは、コンストラクターを呼び出して、データ、レイアウト、コンテキストを渡すだけです。
Myadapter = new Mylistcustom(context, R.layout.YOUR_XML_LAYOUT,DATA);
// and finally set the adapter to your list
ListView lv = (ListView) findViewById(android.R.id.list);
lv.setAdapter(Myadapter);