@@ -55,6 +55,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
5555 int totalHeaderHeight = 0 ;
5656 View menuView = getChildAt (0 );
5757 int menuHeightSpec = heightMeasureSpec ;
58+ int height = MeasureSpec .getSize (heightMeasureSpec );
5859
5960 // If there's more than one child, the header should be first
6061 if (childCount > 1 ) {
@@ -64,7 +65,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
6465 LayoutParams headerLp = (LayoutParams ) headerView .getLayoutParams ();
6566 totalHeaderHeight =
6667 headerView .getMeasuredHeight () + headerLp .bottomMargin + headerLp .topMargin ;
67- int maxMenuHeight = getMeasuredHeight () - totalHeaderHeight - paddingTop ;
68+ int maxMenuHeight = height - totalHeaderHeight - paddingTop ;
6869
6970 // Measure menu
7071 menuView = getChildAt (1 );
@@ -77,7 +78,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
7778 LayoutParams menuLp = (LayoutParams ) menuView .getLayoutParams ();
7879 measureChild (menuView , widthMeasureSpec , menuHeightSpec );
7980 int totalMenuHeight = menuView .getMeasuredHeight () + menuLp .bottomMargin + menuLp .topMargin ;
80- int totalHeight = max (getMeasuredHeight () , paddingTop + totalHeaderHeight + totalMenuHeight );
81+ int totalHeight = max (height , paddingTop + totalHeaderHeight + totalMenuHeight );
8182
8283 setMeasuredDimension (getMeasuredWidth (), totalHeight );
8384 }
0 commit comments