只需重写GridView即可:public class MyGridView extends GridView{ public MyGridView(android.content.Context context, android.util.AttributeSet attrs) { super(context, attrs); } /*... 只需重写GridView即可: public class MyGridView extends GridView { public MyGridView
当ScrollView镶嵌listview会显示不全,通过查看ScrollView测量高度的源码,会发现ScrollView重写了父类viewGroup的measureChildWithMargins方法: 测量child的高度,传递的是UNSPECIFIED(尽可能大的) 再来看看listview自身onMeasure的测量高度方法: final int heightMode = MeasureSpec.getMode(heightMeasureSpec),heightMeasureSpec是