Skip to content

Instantly share code, notes, and snippets.

@karishmaagr
Created April 6, 2023 06:19
Show Gist options
  • Save karishmaagr/3d27ec1363bc06d2ac40c3c3b25c4150 to your computer and use it in GitHub Desktop.
Save karishmaagr/3d27ec1363bc06d2ac40c3c3b25c4150 to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
val list = ArrayList<String>()
list.add("https://www.gstatic.com/webp/gallery/1.jpg")
list.add("https://www.w3schools.com/w3images/fjords.jpg")
list.add("https://fastly.picsum.photos/id/114/200/300.jpg?hmac=RsaHLtW_cVJ2g7oCf2cW_kkIsaHv3QPZgv81ZYH5-aA")
list.add("https://www.w3schools.com/w3images/fjords.jpg")
val adapter = MyPagerAdapter(list,this)
binding.cardViewPager.offscreenPageLimit = 3
binding.cardViewPager.setPageTransformer(true, TinderPageTransformer())
binding.cardViewPager.adapter = adapter
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment