sayyam / carouselview

A simple library to add carousel view in android app.
Apache License 2.0
1.15k stars 260 forks source link

carousel.getCurrentItem into an ImageView? #101

Open aalasafidler opened 5 years ago

aalasafidler commented 5 years ago

I am wondering how to generate a new ImageView from the current item stored in my carousel?

sqljim commented 5 years ago

This should do it for you:

carouselView = (CarouselView) findViewById(R.id.carousel_view);

carouselView.setImageClickListener(new ImageClickListener() {
@Override
     public void onClick(int position) {

CarouselViewPager viewPager = carouselView.getContainerViewPager();

ImageView currentImage = (ImageView) viewPager.getChildAt(position);

}
});
Krusnik02 commented 5 years ago

This is not working - OnClick is calling only of there was click on image. But if caorusel changes there is now click.