I'm working with the CardUI found here.
I would like to inflate these cards with my own layout xml but I do not understand how to.
Here is code for the MainActivity creating the cards
MyCard facebookCard = new MyCard("Continue with Facebook");
MyCard noSignInCard = new MyCard("Continue without log in");
mCardView.addCard(facebookCard);
mCardView.addCard(noSignInCard);
Here is the class for myCard
package com.kc.umassguide;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.fima.cardsui.objects.Card;
public class MyCard extends Card {
public MyCard(String title){
super(title);
}
@Override
public View getCardContent(Context context) {
View view = LayoutInflater.from(context).inflate(R.layout.card_ex, null);
((TextView) view.findViewById(R.id.title)).setText(title);
return view;
}
}
I believe i am supposed to use getCardContent for inflating but I'm sure how to use context.
Any help would be greatly appreciated.
You only need replace R.layout.card_ex with your new layout. Here is another example:
https://github.com/nadavfima/cardsui-for-android/blob/master/CardsExample/src/com/cardsui/example/MyImageCard.java