Android Lyft/剪刀图像裁剪库未加载大图像
我正在使用在我的应用程序中裁剪图像。裁剪器适用于特定大小的图像,但无法将大图像加载到裁剪视图中。我试着用毕加索将图像加载到cropView中,但也没用 我不能在这里上传我的整个课程,但这里有相关的片段Android Lyft/剪刀图像裁剪库未加载大图像,android,image,Android,Image,我正在使用在我的应用程序中裁剪图像。裁剪器适用于特定大小的图像,但无法将大图像加载到裁剪视图中。我试着用毕加索将图像加载到cropView中,但也没用 我不能在这里上传我的整个课程,但这里有相关的片段 import com.lyft.android.scissors.CropView; private CropView mCropView; //This is where it fails. For big images I get an Out Of Memory Exception an
import com.lyft.android.scissors.CropView;
private CropView mCropView;
//This is where it fails. For big images I get an Out Of Memory Exception and the cropView remains blank.
private void handleImagePickedFromGallery(Intent data) {
Uri imageUri = data.getData();
mCropView.extensions().load(imageUri);
}
//this is called when the user clicks on the
//crop button below the cropView
private void onCropClicked() {
mCroppedImage = mCropView.crop(); //get cropped image
ImageView imageView = findViewById(R.id.ic_image);
mCropView.setVisibility(View.GONE);
imageView.setVisibility(View.VISIBLE);
imageView.setImageBitmap(mCroppedImage); //load cropped image
mFab.setImageDrawable(getDrawable(R.drawable.ic_check)); //change crop icon to done
}
这就是XML(怀疑这是否有用):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.rbc.imageselector.ImageControllerActivity">
<ImageView
android:id="@+id/ic_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="Image selected by user"
android:visibility="gone"/>
<com.lyft.android.scissors.CropView
android:id="@+id/crop_view"
android:layout_alignTop="@id/ic_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cropviewViewportRatio="1" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/crop_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="20dp"
android:src="@drawable/ic_crop" />
</RelativeLayout>