How to use wrap_content on SliderLayout height
I want the slider layout height to be wrap_content and equal to the images instead of hardcoding as 200dp.
the same problem
Same here
the same problem when set wrap_content for height attribute ImageSlider dose not show
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) {
}
});`
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) { } });`
where did you add this code?