我不认为这个问题是由我的ListActivity子类引起的。我认为它与我的BaseAdapter子类有关:
package com.mohit.gtodo;
import com.mohit.gtodo.database.TasksDBAdapter;
import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CursorAdapter;
import android.widget.TextView;
public class TasksCursorAdapter extends CursorAdapter {
public TasksCursorAdapter(Context context, Cursor c) {
super(context, c);
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
CheckBox completed = (CheckBox) view.findViewById(R.id.completed);
TextView title = (TextView) view.findViewById(R.id.title);
title.setText(cursor.getString(cursor.getColumnIndex(TasksDBAdapter.KEY_TITLE)));
completed.setChecked(cursor.getInt(cursor.getColumnIndex(TasksDBAdapter.KEY_COMPLETED)) > 0);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.list_item, null);
return view;
}
}
我忘记了方法覆盖吗?
答案 0 :(得分:3)
您正在使用CheckBox,这是一个可点击的项目。当行包含可点击项时,无法再单击该行。而不是使用复选框,使用ListView的choiceMode属性。