@@ -55,6 +55,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
55
55
int totalHeaderHeight = 0 ;
56
56
View menuView = getChildAt (0 );
57
57
int menuHeightSpec = heightMeasureSpec ;
58
+ int height = MeasureSpec .getSize (heightMeasureSpec );
58
59
59
60
// If there's more than one child, the header should be first
60
61
if (childCount > 1 ) {
@@ -64,7 +65,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
64
65
LayoutParams headerLp = (LayoutParams ) headerView .getLayoutParams ();
65
66
totalHeaderHeight =
66
67
headerView .getMeasuredHeight () + headerLp .bottomMargin + headerLp .topMargin ;
67
- int maxMenuHeight = getMeasuredHeight () - totalHeaderHeight - paddingTop ;
68
+ int maxMenuHeight = height - totalHeaderHeight - paddingTop ;
68
69
69
70
// Measure menu
70
71
menuView = getChildAt (1 );
@@ -77,7 +78,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
77
78
LayoutParams menuLp = (LayoutParams ) menuView .getLayoutParams ();
78
79
measureChild (menuView , widthMeasureSpec , menuHeightSpec );
79
80
int totalMenuHeight = menuView .getMeasuredHeight () + menuLp .bottomMargin + menuLp .topMargin ;
80
- int totalHeight = max (getMeasuredHeight () , paddingTop + totalHeaderHeight + totalMenuHeight );
81
+ int totalHeight = max (height , paddingTop + totalHeaderHeight + totalMenuHeight );
81
82
82
83
setMeasuredDimension (getMeasuredWidth (), totalHeight );
83
84
}
0 commit comments