相关疑难解决方法(0)

自定义ListView,日期为SectionHeader(使用自定义SimpleCursorAdapter)

我想显示ListView与Date作为SectionHeader.

我有: 我使用自定义SimpleCursorAdapter从sqlite数据库显示ListView.

我的自定义SimpleCursorAdapter是:

public class DomainAdapter extends SimpleCursorAdapter{
private Cursor dataCursor;

private LayoutInflater mInflater;

public DomainAdapter(Context context, int layout, Cursor dataCursor, String[] from,
        int[] to) {
    super(context, layout, dataCursor, from, to);
        this.dataCursor = dataCursor;
        mInflater = LayoutInflater.from(context);
}


public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;

    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.todo_row, null);

        holder = new ViewHolder();
        holder.text1 = (TextView) convertView.findViewById(R.id.label);//Task Title
        holder.text2 = (TextView) convertView.findViewById(R.id.label2);//Task Date
        holder.img =   (ImageView) convertView.findViewById(R.id.task_icon);

        convertView.setTag(holder);
    } else …
Run Code Online (Sandbox Code Playgroud)

sqlite android listview android-custom-view

26
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

android-custom-view ×1

listview ×1

sqlite ×1