+
81
-

回答

private int mHeaderViewHeight;
private View mHeaderView;

mHeaderView.getViewTreeObserver().addOnGlobalLayoutListener(
new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {

mHeaderViewHeight = mHeaderView.getHeight();
mHeaderView.getViewTreeObserver()
.removeGlobalOnLayoutListener(this);
}
});

高手回复

我知道答案,我要回答