Method ScaleType from url download, failure
Closed this issue · 4 comments
Hi Sir, me again. Thanks for support with your library
Scaling image in the flipper is failing CENTER_INSIDE and FIT_CENTER, it doesnt work correectly when you download a image from a url, flipper dont center images. With drawable works fine
view.setImageScaleType(ScaleType.CENTER_INSIDE);
view.setImageScaleType(ScaleType.FIT_CENTER);
see Screenshots of organization inside fliper. Flipper just move up the images
Version of the library used
'com.github.therealshabi:AutoImageFlipper:1.5.6'
Thanks for attention
Use CENTER_CROP
probably?
Done but, not good.
FIT_CENTER and CENTER_INSIDE work very fine with drawables but downloaded images with (view.setImageUrl(urlImg);) dont
see flipper code:
for ( int i =0;i <establecimientos.size();i++){
FlipperView view = new FlipperView(getActivity());
String urlImg = establecimientos.get(i).getImagen();
view.setImageUrl(urlImg);
view.setImageScaleType(ImageView.ScaleType.FIT_CENTER);
view.setDescriptionBackgroundAlpha(0.2f);
final Establecimiento establecimientoClicked = establecimientos.get(i);
view.setOnFlipperClickListener(new FlipperView.OnFlipperClickListener() {
@OverRide
public void onFlipperClick(FlipperView flipperView) {
Intent intent = new Intent(getActivity(),EstablecimientoActivity.class);
intent.putExtra("Establecimiento a Abrir", establecimientoClicked);
intent.putExtra("vista", 1);
if(!internet)intent.putExtra("banner", BannerSecondShot);
else intent.putExtra("banner", bannerOneShot);
startActivity(intent);
}
});
flipper.setScrollTimeInSec(4);
flipper.addFlipperView(view);
Actually, it all depends upon the resolution of the image used.
- Do one thing, first manually save the image you're trying to load from the url.
- Move that downloaded image into the drawable folder
- Now, load the image directly from the drawable
- Use
FIT_CENTER
orCENTER_INSIDE
, you'll now see that even this drawable image will have the same problem.
The problem is because of the image size and resolution you'll have to think of a workaround for the same