0
我使用Matrix.postRotate()
方法旋轉圖像,但現在不再使用自動縮放以適應父節點LinearLayout
。下面是相關的代碼...在使用Matrix.postRotate()方法後自動縮放圖像
private ImageView rotateimage(ImageView dotimage) {
Matrix matrix=new Matrix();
dotimage.setScaleType(ScaleType.MATRIX);
matrix.postRotate((float) 90, 374, 374);
dotimage.setImageMatrix(matrix);
return dotimage;}
,這裏是我的佈局和ImageView
XML ...
<LinearLayout
android:id="@+id/LinearLayout2"
android:layout_width="550dp"
android:layout_height="550dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/dotdescription"
android:src="@drawable/dots1" />
</LinearLayout>
我有固定的使用方法Matrix.postScale()
縮放,但我真的只是好奇,爲什麼自動縮放不再起作用。
在此先感謝!