commit
0644c9d6cb
@ -38,9 +38,11 @@ class FixedRatioSurfaceView @JvmOverloads constructor(
|
|||||||
newWidth = width
|
newWidth = width
|
||||||
newHeight = (width / aspectRatio).roundToInt()
|
newHeight = (width / aspectRatio).roundToInt()
|
||||||
}
|
}
|
||||||
setMeasuredDimension(newWidth, newHeight)
|
val left = (width - newWidth) / 2;
|
||||||
|
val top = (height - newHeight) / 2;
|
||||||
|
setLeftTopRightBottom(left, top, left + newWidth, top + newHeight)
|
||||||
} else {
|
} else {
|
||||||
setMeasuredDimension(width, height)
|
setLeftTopRightBottom(0, 0, width, height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user