RelativeLayout在实现onMeasure方法时并没有像LinearLayout一样去重写如下代码:
  @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        if (mOrientation == VERTICAL) {
            measureVertical(widthMeasureSpec, heightMeasureSpec);
        } else {
            measureHorizontal(widthMeasureSpec, heightMeasureSpec);
        }
    }

所以导致在View.inflate之后无法通知系统测量布局,如果根布局是RelativeLayout。



相关文章:

  • 2022-02-08
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2021-04-15
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案