解决GridView/ListView第一个Item不显示的问题
2017-02-08 本文已影响96人
峰峰小
解决GridView第一个Item不显示的问题
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
ViewHolder viewHolder = null;
if (null == view) {
viewHolder = new ViewHolder();
view = mLayoutInflater.inflate(R.layout.grid_image_resultlayout, null);
......
view.setTag(viewHolder);
//解决GridView第一个Item不显示的问题
RelativeLayout.LayoutParams newlayoutpa = new RelativeLayout.LayoutParams(this.mWidth, this.mWidth);
view.setLayoutParams(newlayoutpa);
} else {
viewHolder = (ViewHolder) view.getTag();
}
return view;
}