标签:
新建类,继承自GridView,重写onMeasure()方法
public class MyGridView extends GridView { public MyGridView(Context context, AttributeSet attrs) { super(context, attrs); } public MyGridView(Context context) { super(context); } public MyGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } /** * 解决ScrollView嵌套GridView时GridView显示不全问题 */ @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } }
在ScrollView中自定义GridView无法显示全部的问题的解决
标签:
原文地址:http://www.cnblogs.com/mada0/p/4953995.html