自定义适配器在setview binder方法中简单的游标适配器

时间:2014-06-09 11:16:44

标签: android simplecursoradapter

我正在尝试对光标元素进行分组并在列表中显示它们。现在我无法获得用户刷过的特定视图,请帮助我

@Override
   public View getView(int position, View convertView, ViewGroup parent) {
          View v = convertView;
          final Item i = items.get(position);
          if (i != null) {
                 if(i.isSection()){
                       SectionItem si = (SectionItem)i;
                       v = vi.inflate(R.layout.list_item_section, null);
                       final TextView sectionView = (TextView) v.findViewById(R.id.list_item_section_text);
                     //sectionView.setText(si.g);
                       sectionView.setText(si.getTaskType());
                       v.setOnClickListener(null);
                       v.setOnLongClickListener(null);
                       v.setLongClickable(false);
                 }else{
                       EntryItem ei = (EntryItem)i;
                       v = vi.inflate(R.layout.layout_list_item, null);
                       final TextView tskTime = (TextView)v.findViewById(R.id.taskTime);
                       final TextView tskName = (TextView)v.findViewById(R.id.taskName);

                        if (tskTime != null) tskTime.setText(ei.getCategory());
                       if (tskName != null) tskName.setText(ei.getTaskName());
                 }
          }
          return v;
   }

The screen shot of my screen

0 个答案:

没有答案