robert_hly

踩坑填坑记录...

导航

自定义ListView 、GradView 重写onMeasure方法让其正确显示

1 继承原始的

2 重写onMeasure方法

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
  MeasureSpec.AT_MOST);
  super.onMeasure(widthMeasureSpec, expandSpec);
}

posted on 2017-03-25 15:14  robert_hly  阅读(161)  评论(0编辑  收藏  举报