AndroidImageSlider
AndroidImageSlider copied to clipboard
How can I override methods to set "wrap_content" for the sliderview instead of giving a specify width/height
How can I override methods to set "wrap_content" for the sliderview instead of giving a specify width/height?
and thanks for such a useful library.
Hurray!
I finally solve it by some tricky ways. but i hope you should fix this as this can be important for some developers.
Anyway, thanks for your library.
@capsulejj can you share the way. Because wrap_content and match_parent are not working in SliderLayout
I need to find it out. But I really think my way is really terrible and unexplainable. I will give it to you if i found it
@capsulejj when you find it out i would like to know your solution as well,thanks!
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) { } });`
how to implement this if I'm not using picasso ?
with
get the image size and resize height image to the percent of width image in the display