ImageView的ScaleType屬性詳解

2021-07-09 05:23:28 字數 1165 閱讀 3349

public static final imageview.scaletype center

在檢視中使影象居中,不執行縮放。 在 xml 中可以使用的語法: android:scaletype="center"。

public static final imageview.scaletype center_crop

均衡的縮放影象(保持影象原始比例),使的兩個座標(寬、高)都大於等於 相應的檢視座標(負的內邊距)。影象則位於檢視的**。 在 xml 中可以使用的語法:android:scaletype="centercrop"。

public static final imageview.scaletype center_inside

均衡的縮放影象(保持影象原始比例),使的兩個座標(寬、高)都小於等於 相應的檢視座標(負的內邊距)。影象則位於檢視的**。 在 xml 中可以使用的語法:android:scaletype="centerinside"。

public static final imageview.scaletype fit_center

使用 center 方式縮放影象。 在 xml 中可以使用的語法: android:scaletype="fitcenter」。也可以這麼理解:

把按比例擴大/縮小到view的寬度,居中顯示

public static final imageview.scaletype fit_end

使用 end 方式縮放影象。 在 xml 中可以使用的語法: android:scaletype="fitend"。

public static final imageview.scaletype fit_start

使用 start 方式縮放影象。 在 xml 中可以使用的語法:android:scaletype="fitstart"。

public static final imageview.scaletype fit_xy

使用 fill 方式縮放影象。 在 xml 中可以使用的語法: android:scaletype="fitxy"。

public static final imageview.scaletype matrix

繪製時,使用影象矩陣方式縮放。影象矩陣可以通過 setimagematrix(matrix) 設定。在 xml 中可以使用的語法: android:scaletype="matrix"。

變形 縮放 scale

縮放 scale 函式讓元素根據中心原點對物件進行縮放。縮放 scale 具有三種情況 1 scale x,y 使元素水平方向和垂直方向同時縮放 也就是x軸和y軸同時縮放 例如 div hover注意 y是乙個可選引數,如果沒有設定y值,則表示x,y兩個方向的縮放倍數是一樣的。2 scalex x ...

ImageView的scaleType的屬性

imageview的scaletype的屬性值有matrix,fit xy,fit start,fit end,fit center,center,center crop,center inside.1.android scaletype center 保持原圖的大小,顯示在imageview的中心...

ImageView的scaleType的屬性理解

imageview的scaletype的屬性值有matrix,fit xy,fit start,fit end,fit center,center,center crop,center inside.1.android scaletype center 保持原圖的大小,顯示在imageview的中心...