rubensousa/ViewPagerCards

Setting different texts to each card

azeyneloglu opened this issue · 2 comments

Hello,

Thanks for the implementation, it is of great help.

I am having some trouble with changing the content of each card dynamically. not from the layout xml. I would like to set different texts to each card. How can I achive this by using the adapter you've designed?

Thank you

Take a look at CardPagerAdapter: https://github.com/rubensousa/ViewPagerCards/blob/master/app/src/main/java/com/github/rubensousa/viewpagercards/CardPagerAdapter.java

You need to provide a list of data (in that example, I use a list of strings) and then assign the text on
instantiateItem

From the example, you can populate the mData array with the strings you want to set and then you can assign the strings to any of the textviews (either the title or the body). Great library by the way. Thanks @rubensousa