//ExpandableListView的适配器
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
GroupViewHolder gvholder;
if (convertView == null) {
gvholder = new GroupViewHolder();
convertView = LinearLayout.inflate(getBaseContext(),
R.layout.group_layout, null);
gvholder.groupcity = (TextView) convertView
.findViewById(R.id.group_title);
gvholder.groupsize = (TextView) convertView
.findViewById(R.id.groupcap);
gvholder.groupload = (ImageView) convertView
.findViewById(R.id.group_state);
convertView.setTag(gvholder);
} else {
gvholder = (GroupViewHolder) convertView.getTag();
}
// ExpandableListView 的OnGroupClick监听
allcitylists.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
// TODO Auto-generated method stub
group_checked[groupPosition] = group_checked[groupPosition] + 1;
((BaseExpandableListAdapter) expadapter).notifyDataSetChanged();
if (groupPosition < 5
|| groupPosition >= provincelist.size() - 3) {
ArrayList<MKOLSearchRecord> records = mOffline
.searchCity(provincelist.get(groupPosition).get(0));
if (records != null && records.size() == 1) {
cityid =
records.get(0).cityID;
mOffline.start(cityid);
updateView();
//改变的组件
TextView loadtext = (TextView) v
.findViewById(R.id.group_loadtitle);
loadtext.setVisibility(View.VISIBLE);
changeloadtext(loadtext, cityid);
}
}
return false;
}
});
内容比较多,没贴完,但关键的地方都在上面,点击列表项能够把loadtext显示出来,但是上下滑动之后,显示的就不是我刚刚点击的那个列表项的TextView,而是其他列表项的Textview,应该是不能在这里用ViewHolder,但是我也想不出来怎么改变,请各位大神指教指教