クリスチャンは正しかったです(もし彼がそれを答えとして投稿していたら、私はそれを単に受け入れたでしょう;))。
解決策は、独自のアダプターを作成することでした。これはかなり単純であることが判明しましたが、要素の可視性を設定するときにいくつかの落とし穴があります。基本的に、非表示にするか表示するかに関係なく、毎回設定する必要があります。そうしないと、リストをスクロールするときに、別のリスト要素が非表示の要素を表示するはずがないときに、突然非表示の要素が表示されたり、その逆になったりすることがわかります。コード例を次に示します。
public class SpellListAdapter extends CursorAdapter {
private LayoutInflater mLayoutInflater;
private Context mContext;
public SpellListAdapter(Context context, Cursor c) {
super(context, c);
mContext = context;
mLayoutInflater = LayoutInflater.from(context);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View v = mLayoutInflater.inflate(R.layout.list_item_fave, parent, false);
return v;
}
@Override
public void bindView(View v, Context context, Cursor c) {
String spell = c.getString(c.getColumnIndexOrThrow(SpellDbAdapter.KEY_SPELL));
int fave = c.getInt(c.getColumnIndexOrThrow(SpellDbAdapter.KEY_FAVORITE));
TextView Spell = (TextView) v.findViewById(R.id.text);
if (Spell != null) {
Spell.setText(spell);
}
//Set Fave Icon
TextView Fave = (TextView) v.findViewById(R.id.fave_icon);
//here's an important bit. Even though the element is set to invisible by
//default in xml, we still have to set it every time. Then, if the
//spell is marked as a favorite, set the view to visible.
Fave.setVisibility(View.INVISIBLE);
if (fave == 1){
Fave.setVisibility(View.VISIBLE);
}
}
}