Displaying a specific layout for a map when using is CardViewquite simple.
I created an XML layout for my map and am instantiating this XML layout for presentation using LayoutInflater.
More specific:
View largeCardView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card_view, viewGroup, false);
which is called in onCreate()my method RecyclerAdapter. Then the method onCreatereturns this one largeCardVew. This works great and maps are displayed as they are laid out in an XML file.
But what if I want to display different maps for different content? Can I show different cards for different things, but are they all in the same one RecyclerView?
For example, if I know in advance that the card will contain a string passed to TextView, and this string can have only two values: “Large” and “Small”, how can I use one type of XML file for use with “Big” text and another An XML file for use with Small Text?
Here is an example (taken from Google Play ):

As you can see in the picture, there are two different types of cards, with different layouts (ignore the orange button). Is there a way to achieve a similar thing and have cards in the same thing RecyclerView?
source
share