Android アプリケーションに Imageview があります。画像を移動して拡大縮小したい。また、画像の選択した部分をトリミングしたい(写真/画像エディターと同じように)。どうすればこれを達成できますか?
前もって感謝します
このようなことをしてください:
Intent intent = new Intent("com.android.camera.action.CROP");
// this will open all images in the Galery
intent.setDataAndType(photoUri, "image/*");
intent.putExtra("crop", "true");
// this defines the aspect ration
intent.putExtra("aspectX", aspectY);
intent.putExtra("aspectY", aspectX);
// this defines the output bitmap size
intent.putExtra("outputX", sizeX);
intent.putExtra("outputY", xizeY);
// true to return a Bitmap, false to directly save the cropped iamge
intent.putExtra("return-data", false);
//save output image in uri
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
<ImageView
android:id="@+id/imgProfilePic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image"
android:scaleType="fitCenter" <!-- TO CROP/SCALE -->
android:gravity="center" <!-- TO MOVE -->
/>
これがあなたに役立つことを願っています