小编con*_*eur的帖子

为什么android SimpleCursorAdapter bindView复制第一行?

我已经扩展了SimpleCursorAdapter并且遇到了一个奇怪的问题,即bindView,它似乎在第一行被调用了两次.

只有第一行似乎是重复的.我有一种感觉它与光标的定位方式有关,但已查看了所有的适配器类,似乎无法找到它发生的位置.

这是我的bindView代码,我插入了一些日志来显示我所看到的内容.

@Override
public void bindView(View view, Context context, Cursor cursor) {
    final ViewBinder binder = getViewBinder();
    final int count = mTo.length;
    final int[] from = mFrom;
    final int[] to = mTo;

    Log.v("builder", "cursor count"+cursor.getCount() );

    Log.v("builder", "mTo.length"+count);
    //Bind all Views
    for (int i = 0; i < count; i++) {
        final View v = view.findViewById(to[i]);
        if (v != null) {
            boolean bound = false;
            if (binder != null) {
                bound = binder.setViewValue(v, cursor, from[i]);
            }

            if (!bound) { …
Run Code Online (Sandbox Code Playgroud)

android simplecursoradapter

0
推荐指数
1
解决办法
2514
查看次数

标签 统计

android ×1

simplecursoradapter ×1