Created
November 6, 2019 09:16
-
-
Save lobothijau/2650bfff6d01ae31bac08a93370e52b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
var sampleImages = arrayOf( | |
"https://raw.githubusercontent.com/sayyam/carouselview/master/sample/src/main/res/drawable/image_3.jpg", | |
"https://raw.githubusercontent.com/sayyam/carouselview/master/sample/src/main/res/drawable/image_1.jpg", | |
"https://raw.githubusercontent.com/sayyam/carouselview/master/sample/src/main/res/drawable/image_2.jpg" | |
) | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val carouselView = findViewById(R.id.carouselView) as CarouselView; | |
carouselView.setPageCount(sampleImages.size); | |
carouselView.setImageListener(imageListener); | |
} | |
var imageListener: ImageListener = object : ImageListener { | |
override fun setImageForPosition(position: Int, imageView: ImageView) { | |
// You can use Glide or Picasso here | |
Picasso.get().load(sampleImages[position]).into(imageView) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment