ContentScales

interface ContentScales

提供了一组预定义的内容缩放规则(ContentScale)以及创建自定义规则的方法。

Author

M8Test, [email protected], https://m8test.com

Functions

Link copied to clipboard
abstract fun createFixed(value: Float): ContentScale

创建一个使用固定缩放因子的内容缩放规则。

Link copied to clipboard
abstract fun getCrop(): ContentScale

均匀缩放源内容(保持宽高比),使其尺寸大于或等于目标容器,然后居中裁剪超出部分。 类似于 ImageView.ScaleType.CENTER_CROP

Link copied to clipboard
abstract fun getFillBounds(): ContentScale

非均匀缩放源内容,使其宽度和高度都与目标容器完全匹配,可能会改变内容的宽高比。

Link copied to clipboard
abstract fun getFillHeight(): ContentScale

均匀缩放源内容(保持宽高比),使其高度与目标容器的高度完全匹配。宽度可能会超出或小于容器宽度。

Link copied to clipboard
abstract fun getFillWidth(): ContentScale

均匀缩放源内容(保持宽高比),使其宽度与目标容器的宽度完全匹配。高度可能会超出或小于容器高度。

Link copied to clipboard
abstract fun getFit(): ContentScale

均匀缩放源内容(保持宽高比),使其尺寸小于或等于目标容器,完全显示在容器内。 类似于 ImageView.ScaleType.FIT_CENTER

Link copied to clipboard
abstract fun getInside(): ContentScale

如果源内容大于目标容器,则行为与 Fit 类似。如果源内容小于或等于目标容器,则不进行缩放。 类似于 ImageView.ScaleType.CENTER_INSIDE

Link copied to clipboard
abstract fun getNone(): ContentScale

不应用任何缩放。源内容将以其原始尺寸绘制。