cardslib
cardslib copied to clipboard
ListView of Built-in Cards
Hi Gabriele, I tried creating list view of built-in MaterialLargeImageCard but I get empty cards, neither image nor title.
MaterialLargeImageCard card1 = MaterialLargeImageCard.with(MainActivity.this)
.setTextOverImage("Current Projects")
.useDrawableId(R.drawable.projects)
.build();
MaterialLargeImageCard card2 = MaterialLargeImageCard.with(MainActivity.this)
.setTextOverImage("About Enactus")
.useDrawableId(R.drawable.about)
.build();
ArrayList < Card > cards = new ArrayList < > ();
cards.add(card1);
cards.add(card2);
CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(MainActivity.this.getApplicationContext(), cards);
CardListView listView = (CardListView) MainActivity.this.findViewById(R.id.myList);
if (listView != null) {
listView.setAdapter(mCardArrayAdapter);
}
<it.gmariotti.cardslib.library.view.CardListView
android:layout_width="match_parent"
android:layout_height="match_parent"
card:list_card_layout_resourceID="@layout/custom_layout"
android:id="@+id/myList"/>
custom_layout.xml
<it.gmariotti.cardslib.library.view.CardViewNative
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card="http://schemas.android.com/apk/res-auto"
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card:card_layout_resourceID="@layout/native_material_largeimage_card"
style="@style/card_external"
/>
I guess Card doesn't get to know about the image, text of the MaterialLargeImageCard object but can you please tell me some other way or workaround to get the expected results?
Regards, Ashish Bansal