AndroidImageSlider
AndroidImageSlider copied to clipboard
Set Picasso for Android Image Slider
I need to use defaultSliderView.setPicasso(picasso) for Android Image Slider but when I use the following code, don't work and only spins Progress Bar with out any error. And don't load my photo.
The First Way :
SliderLayout sliderLayout = (SliderLayout) findViewById(R.id.slider);
DefaultSliderView defaultSliderView = new DefaultSliderView(Context);
Picasso picasso = Picasso.with(Context);
picasso.load(imageUrl).resize(100, 100);
defaultSliderView.setPicasso(picasso);
sliderLayout.addSlider(defaultSliderView);
But this following way is responsive. And but I need to First Way. So help me to use The First Way. (because I need resize photo : Picasso.load(imageUrl).resize(100, 100) and after i need set this resized photo on slider layout)
The Second Way :
SliderLayout sliderLayout = (SliderLayout) findViewById(R.id.slider);
DefaultSliderView defaultSliderView = new DefaultSliderView(Context);
defaultSliderView.image(imageUrl);
sliderLayout.addSlider(defaultSliderView);
Libraries :
Picasso : compile 'com.squareup.picasso:picasso:2.5.2'
Image Slider : compile 'com.daimajia.slider:library:1.1.5@aar'
same question how to use setPicasso(picasso) correctly
You can check this library https://github.com/OpenSooq/Pluto it has the ability to have full control over your views and layout and not depending on any image library
Hi @DigiGostar
You only need to provide slider with pre-configured Picasso instance, it did picasso.load by itself. Your code shall be as follow
SliderLayout sliderLayout = (SliderLayout) findViewById(R.id.slider);
DefaultSliderView defaultSliderView = new DefaultSliderView(Context);
Picasso picasso = Picasso.with(Context);
defaultSliderView.setPicasso(picasso);
defaultSliderView.image(imageUrl);
sliderLayout.addSlider(defaultSliderView);