therealshabi/AutoImageFlipper

Method ScaleType from url download, failure

Closed this issue · 4 comments

Jejid commented

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

ss2
ss1

Version of the library used
'com.github.therealshabi:AutoImageFlipper:1.5.6'

Thanks for attention

Use CENTER_CROP probably?

Jejid commented

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);

with CENTER_CROP
4
3

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 or CENTER_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

Jejid commented

Many thanks, ill try fix it changing size of images but when i load the image directly from the drawable its works fine.

see

4
3