У меня проблема, я хочу добавить разные элементы в одну группу в расширяемом спискеView, как на картинке. Возможно? Я знаю, что я должен использовать метод getChildView в адаптере?Различные элементы в группе в расширяемом ListView
case 2:
if (childPosition==0){
infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.group_item, null);
txtListChild=(TextView)convertView
.findViewById(R.id.tv_group_name) ;
txtListChild.setText("Вот они, родненькие условия использования)");
}
else{
c = db.getAccamulativeListOfCompany(companyID);
infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item_accumulative_list, null);
txtListChild = (TextView) convertView
.findViewById(R.id.lblListItem);
Log.d("myLogs", "group_pos=" + groupPosition + "," + childPosition);
TextView tvDiscount = (TextView) convertView.findViewById(R.id.tv_accumulative_discount);
ImageView ivAccamulative = (ImageView) convertView.findViewById(R.id.iv_accamulative_item);
if (c != null) {
if (c.moveToFirst()) {
c.moveToPosition(childPosition-1);
txtListChild.setText(c.getString(1) + " руб.");
tvDiscount.setText(c.getString(2) + "%");
File imgFile = new File(c.getString(4));
if (imgFile.exists()) {
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ivAccamulative.setImageBitmap(myBitmap);
}
}
}
}
break;
я попробовать, но я проблема, у меня есть 1 пункт (текст) и 4 пункта в курсоре, в результате у меня есть: первый -text пункт и 3 следующего от курсор. Я теряю 1 пункт из курсора. –
Я добавил свой код ниже –
отрегулировать ваш счетчик детей, чтобы дать вам дополнительный ребенок? Поскольку вы добавляете один элемент не в курсор. По-видимому, вы уже меняете указатель на свой курсор. – NameSpace