我已经制作了一个应用程序,其中我在自定义gridview中显示数据并且它运行良好但问题是当我滚动它并回到底部并返回顶部然后所有项目位置可以自动更改。有时它不会出现在滚动之后。这是我的代码,我认为有些问题getView
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder viewholder;
// LayoutInflater inflator = activit.getLayoutInflater();
if(convertView == null) { // recycled view is null so create it.
viewholder = new ViewHolder();
convertView = inflator.inflate(R.layout.gridviewrow, null);
viewholder.imgvGridItem = (RelativeLayout) convertView
.findViewById(R.id.rlGreidItemicon);
viewholder.txtGridItemlabel = (TextView) convertView
.findViewById(R.id.txtGridItemlabel);
if ((lstpinfo.get(position).appname.toString()) != null) {
viewholder.imgvGridItem.addView(getimageviewimage(lstpinfo
.get(position).icon));
viewholder.txtGridItemlabel
.setText(lstpinfo.get(position).appname.toString());
}
}
return convertView;
}