nstudio / nativescript-cardview

:diamonds: :clubs: NativeScript widget for Material Design CardView
MIT License
282 stars 51 forks source link

Dynamically create cards and append to StackLayout. #80

Closed UD-UD closed 6 years ago

UD-UD commented 6 years ago

Is there a way to create the cards dynamically and append them to a layout. I want something like

let card = new Card();
/*
*Add various card data and styling
*/ 
stacklayout.append(card); // stacklayout is the reference to layout on the screen.
BharathaAravind commented 6 years ago

you can add cards as child to the layout. In your case it would be something like stacklayout.addChild(card); A whole example could be : var stk = page.getViewById('stackLayoutID'); var card = new CardView(); card.margin = 10; card.radius = 5; card.elevation = 40; card.height = 40; stk.addChild(card);