我又是在这里有一个问题
我想箱列表项与ImageView的和TextView中的自定义视图,也是我需要添加标题的具体的位置。我从来没有使用切片的ListView呢。
我需要添加多个的TextView和ImageView的
在列表项,也是我需要添加头的
在一些随机的位置。请帮我解决这个。我已经用Google搜索它,我发现了一些例子还,但我无法自定义
吧。
i am again here with one issue
i want to crate a custom view of list item with imageview and textview's and also i need to add header's on specific positions. i never used sectioned listview yet.
I need to add more than one textview and imageview
in listitem and also i need to add header's
at some random positions. please help me in solving this. i had googled it and i found some examples also but i am unable to customize
it.
在此先感谢。 MAHAVEER。
Thanks in advance. Mahaveer.
我理解这一点。你应该增加类似在模型中的头
多个属性。
I understood it a little bit. You should add more attribute like header
in your model.
如果你的头
= 真正,并在适配器
类,则有膨胀的布局 header.xml
。否则,如果头
= 假,那么你应该夸大你的XML文件,即(的TextView
,的ImageView
)为正常。
If your header
= true and in your adapter
class, then you have to inflate the layout header.xml
. Otherwise, if header
= false, then you should inflate your xml file i.e. (TextView
,ImageView
) as normal.
下面分隔符
在我的code是一样的头
Here separator
in my code is the same as your header
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final recordModel model = records.get(position);
ViewHolder holder;
convertView = null;
holder = new ViewHolder();
if(records.get(position).getSeparator()==0){
convertView = inflater.inflate(R.layout.record_row, null);
convertView.setTag(holder);
holder.imageView = (ImageView) convertView
.findViewById(R.id.iconCallType);
holder.title = (TextView) convertView.findViewById(R.id.title);
holder.note = (TextView) convertView.findViewById(R.id.note);
holder.checkBox = (CheckBox) convertView.findViewById(R.id.check_box);
..........................
}else if(records.get(position).getSeparator()==1){
convertView = inflater.inflate(R.layout.separator, null);
convertView.setTag(holder);
holder.title = (TextView) convertView.findViewById(R.id.textSeparator);
holder.title.setText(records.get(position).getCallDay());
}
return convertView;
}