public class MyGridView extends GridView {
public MyGridView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public MyGridView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public MyGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
return false;
}
return super.onTouchEvent(ev);
}
super.onMeasure(widthMeasureSpec, expandSpec);
}
}
public MyGridView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public MyGridView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public MyGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public boolean onTouchEvent(MotionEvent ev) {
//解决滑动
if (ev.getAction() == MotionEvent.ACTION_MOVE) {return false;
}
return super.onTouchEvent(ev);
}
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//解决空白
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);super.onMeasure(widthMeasureSpec, expandSpec);
}
}