我使用ImageView來顯示圖片,我希望圖片以真實尺寸顯示,但是我希望圖片可以完整顯示在圖片中。我設置了其他scaleType,比如'centerInside',那麼圖片不能在rect中顯示,但'center'可以。我想知道如何編碼,可以顯示一個小於自身的矩形圖片。如何使用android:scaleType來顯示圖片
<ImageView
android:id="@+id/imageView2"
android:layout_width="20.0dip"
android:layout_height="20.0dip"
android:adjustViewBounds="true"
android:contentDescription="@string/boy"
android:paddingLeft="20.0dip"
android:paddingTop="40.0dip"
android:scaleType="center"
android:src="@drawable/boy" />
你已經回答了你的問題'「但‘中心’可以」' – Houcine
「的執行情況中心'只是顯示圖片的一部分,而不是完整的圖片。 – user2682897
嘗試'android:scaleType =「centerCrop」' – Houcine