AndroidImageSlider icon indicating copy to clipboard operation
AndroidImageSlider copied to clipboard

slider height , Can't set to wrap_content

Open d7coders opened this issue 10 years ago • 2 comments

Hi, How can I set the Slider's height to wrap_content instead of specific height ?

d7coders avatar Aug 14 '15 23:08 d7coders

I have the same problem. It makes the whole library unusable!

mahmouxd avatar Jan 24 '16 12:01 mahmouxd

i fix it with

` Picasso.get().load(imageUrl)).into(new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {

                int width = bitmap.getWidth();
                int height = bitmap.getHeight();

                int tempWidth = (int) (width / Resources.getSystem().getDisplayMetrics()
                    .density);

                int sliderHeight = (int) (height / Resources.getSystem().getDisplayMetrics()
                    .density) * slider.getWidth() / tempWidth;
                ;

                slider.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams
                    .MATCH_PARENT, sliderHeight));
            }

            @Override
            public void onBitmapFailed(Exception e, Drawable errorDrawable) {

            }

            @Override
            public void onPrepareLoad(Drawable placeHolderDrawable) {

            }
        });`

MrzAhmadi avatar Sep 10 '18 12:09 MrzAhmadi