Skip to content

Commit 0f18d90

Browse files
cketchampekingme
authored andcommitted
Prevent setting a height less than requested by using Math.round()
PiperOrigin-RevId: 290707432
1 parent bd7de3d commit 0f18d90

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/java/com/google/android/material/tabs/TabLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ protected void onDraw(@NonNull Canvas canvas) {
15671567
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
15681568
// If we have a MeasureSpec which allows us to decide our height, try and use the default
15691569
// height
1570-
final int idealHeight = (int) ViewUtils.dpToPx(getContext(), getDefaultHeight());
1570+
final int idealHeight = Math.round(ViewUtils.dpToPx(getContext(), getDefaultHeight()));
15711571
switch (MeasureSpec.getMode(heightMeasureSpec)) {
15721572
case MeasureSpec.AT_MOST:
15731573
if (getChildCount() == 1 && MeasureSpec.getSize(heightMeasureSpec) >= idealHeight) {

0 commit comments

Comments
 (0)