0
			convertView = ph.rootView;
			convertView.setTag(ph);
		} else { 
			ph = (PageHolder) convertView.getTag();
		} 
		ph.adapter.resetDataForReuse(ph.gridView, provider, pageIndex);
		ph.gridView.setAdapter(ph.adapter);
		perShowGridConfig(ph.gridView, pageIndex);// 用户可以自定义
		return convertView;
	} 
 
	@Override 
	public void onDataChanged(PageDataProvider<T> provider) {
		if (provider != null) {
			perPageItemCount = provider.getDefaultPerPageItemCount();
		} 
	} 
 
	@Override 
	public void onPageRecycle(View page) {
		// if (page != null) { 
		// PageHolder ph = null; 
		// try { 
		// ph = (PageHolder) page.getTag(); 
		// } catch (Exception e) { 
		// ph = null; 
		// } 
		// if (ph != null) { 
		// GridViewAdapter adapter = null; 
		// try { 
		// adapter = (GridViewAdapter) ph.gridView.getAdapter(); 
		// } catch (Exception e) { 
		// ph = null; 
		// } 
		// if (adapter != null) { 
		// adapter.clearDataNotify(); 
		// return; 
		// } 
		// } 
		// } 
 
	} 
 
	class PageHolder { 
		LinearLayout rootView;
		GridView gridView;
		GridViewAdapter adapter;
	} 
 
	/** 
	 * 创建一个页面 
	 *  
	 * @return 
	 */ 
	private PageHolder createPage(Context context) {
		PageHolder pageHolder = new PageHolder();
		pageHolder.adapter = new GridViewAdapter();
		// pageHolder.pageView = crateGridView(context); 
		crateGridView(context, pageHolder);
		pageHolder.gridView.setAdapter(pageHolder.adapter);
		return pageHolder;
	} 
 
	private GridView crateGridView(Context context, PageHolder ph) {
		LinearLayout box = new LinearLayout(context);
		ViewGroup.LayoutParams boxLp = new ViewGroup.LayoutParams(mMaxW, mMaxH);
		box.setLayoutParams(boxLp);
		// 
		GridView g = new GridView(context);
		LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
				getGridWidth(), getGridHeight()); 
		g.setLayoutParams(lp);
		box.addView(g);
		// 
		ph.rootView = box;
		ph.gridView = g;
		// 
		g.setColumnWidth(getColumnWidth());
		g.setNumColumns(mColumns);
		g.setGravity(Gravity.CENTER);
		g.setVerticalSpacing(mVerticleSpace);
		g.setHorizontalSpacing(mHorizontalSpace);
		int left = 0;
		int top = 0;
		int right = 0;
		int bottom = 0;
		if (useHorizontalPadding) {
			left = mHorizontalSpace;
			right = mHorizontalSpace;
		} 
		if (useVerticlePadding) {
			bottom = mVerticleSpace;
			top = mVerticleSpace;
		} 
		g.setPadding(left, top, right, bottom);
		// g.setOnItemClickListener(innerListener); 
		// g.setOnItemLongClickListener(innerLongClickListener); 
		g.setSelector(android.R.color.transparent);
		// 由于4.0系统存在位置的bug,只能试试ItemView的OnClick和OnLongClick代替处理 
		// g.setOnItemClickListener(mItemClickListener); 
		// g.setOnItemLongClickListener(mItemLongClickListener); 
		return g;
	} 
Contextual code suggestions in your IDE  Get Codota for Java