Closed jsericksk closed 2 years ago
I noticed that setting the image directly with the library can solve this problem, depending on the library used. With Glide:
Glide.with(context).load(imageUrl).centerInside().into(photoEditorView.source)
I didn't get the same behavior with Coil, which is my focus. Even though the ImageView has a scaleType defined before, Coil apparently doesn't use it. Alternatively, as a workaround, I set a size to be used when loading the image. This way, the image has the usual appearance of a FIT_CENTER scale.
photoEditorView.source.load(imageUrl) {
size(2000)
}
This issue is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 4 days.
This issue was closed because it has been stalled for 5 days with no activity.
mPhotoEditorView.source.scaleType = ImageView.ScaleType.CENTER_CROP
fun loadImage(imgURL: Uri?, errorThumb: Int?, imgView: PhotoEditorView?,mMeasuredWidth:Int) {
imgView?.source?.load(imgURL) {
placeholder(errorThumb ?: 0)
error(errorThumb ?: 0)
memoryCachePolicy(CachePolicy.ENABLED)
allowHardware(false)
size(mMeasuredWidth)
}
}
This worked in my case I am using Coil to load Image
When I try to load an image with some image library, the image behaves differently than normal. This issue also occurs when using an image stored on the device.
setImageResource()
is the only no that has this problem, when the image is loaded locally in res/drawable.Using the Coil library:
photoEditorView.source.load(imageUrl)
. The same happens withphotoEditorView.source.setImageURI(URI)
andphotoEditorView.source.setImageBitmap(Bitmap)
:Using
photoEditorView.source.load(resource)
:Changing the scale type with
photoEditorView.source.scaleType
has no effect.