0

Im using Cardslib inside my project Is it possible to inflate another Layouts inside the CardsWithList? I want to add a somekind of footer at the end which would be clickable to open another fragment

RedEagle
  • 2,358
  • 3
  • 13
  • 18

1 Answers1

1

If you want to use different layouts for each row in CardWithList, you can't do it.

If you want to use a custom layout for the

As other cards you can use a custom inner layout instead of the default layout. You can set it in your constructor for example:

public WeatherCard(Context context) {
    super(context,R.layout.carddemo_extras_inner_base_main_cardwithlist);
}

Your layout have to provide an element with `

<it.gmariotti.cardslib.library.prototypes.LinearListView
        android:id="@+id/card_inner_base_main_cardwithlist"
    />

Also you can add other elements inside you layout.
In this case you have to set them with the method setupInnerViewElements. In this case it is very important to call the super method.

 @Override
    public void setupInnerViewElements(ViewGroup parent, View view) {
        //It is very important call the super method!!
        super.setupInnerViewElements(parent, view);

        //Your elements
    }

You can find more info here:

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • Yea I've already inflated the custom layout and it works fine :). I'm not sure I understand what ou mean by adding other elements inside my layout? can you explain more? – RedEagle Oct 18 '15 at 12:12
  • If you have a button for example use that method to set an OnClickListener – Gabriele Mariotti Oct 18 '15 at 12:23