0
我在嘗試將一個方形圖像(即大約315dp x 315dp)縮放到應填充寬度並具有大約200dp高度的圖像時遇到了一些麻煩。如何正確縮放一個矩形imageview到一個矩形imageview?
基本上我試圖做的是隻是適當地保留圖像的長寬比,當它被縮放到一個更長的形狀。有任何想法嗎?以下是我已經試過:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
</LinearLayout>