therealshabi / AutoImageFlipper

Auto Scrolling Image Pager with Pager Indicator and Text
Apache License 2.0
106 stars 25 forks source link

Method ScaleType from url download, failure #21

Closed Jejid closed 5 years ago

Jejid commented 5 years ago

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

therealshabi commented 5 years ago

Use CENTER_CROP probably?

Jejid commented 5 years ago

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

therealshabi commented 5 years ago

Actually, it all depends upon the resolution of the image used.

The problem is because of the image size and resolution you'll have to think of a workaround for the same

Jejid commented 5 years ago

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