gabrielemariotti / cardslib

Android Library to build a UI Card
4.66k stars 1.19k forks source link

Possible to create a card using an already inflated view? #324

Open legomind opened 10 years ago

legomind commented 10 years ago

Something like this:

public class MyCardLayout extends LinearLayout {
  //Inflate & attach event listeners 
}
void onCreate() {
    MyCardLayout myCardLayout = new MyCardLayout();

    Card card = new Card(getContext(), (View) myCardLayout); //Pass view instead of layout id

    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_card_id);
    cardView.setCard(card);
}
gabrielemariotti commented 10 years ago

It can be an idea for a future addition.

dodgex commented 9 years ago

+1 for this feature