その方が良いので、セパレーターの列挙で動作します。しかし、あなたの場合
public Cursor getItemList(){
return db.rawQuery("SELECT * FROM Items NATURAL JOIN Separators ON Item.separator_id = Separators._id");
}
カスタム CursorAdapter を作成し、bindView メソッド内で独自の方法で管理します。セパレーターのビューを含むレイアウトには、内部にセパレーターの ImageView が含まれている必要があります。
public class MyCursorAdapter extends CursorAdapter {
LayoutInflater inflater;
public MyCursorAdapter(Context context, Cursor c) {
super(context, c);
inflater = LayoutInflater.from(context);
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
//cursor is already setted to requared position, just get your column
TextView tv1 = (TextView)view.findViewById(R.id.textView1);
TextView tv2 = (TextView)view.findViewById(R.id.textView2);
tv1.setText(cursor.getString(1));
tv2.setText(cursor.getString(2));
ImageView myImageView = (ImageView)fimdViewById(R.id.my_image_view);
if(cursor.getString(5) == "line"){
myImageView = getResources().getIdentifier("yourpackagename:drawable/line.png");
}else if(cursor.getString(5) == "wave"){
myImageView = getResources().getIdentifier("yourpackagename:drawable/wave.png");
...
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
//here is view for each raws
return inflater.inflate(R.layout.my_raw_view, parent, false);
}
}