var cardview = new CardView(this);
var layoutparams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
cardview.LayoutParameters = layoutparams;
// and you can set the card view's other properties
//if you want to add the card view into the linearlayout you can use
linearlayout.AddView(cardview,0); // the 0 is the index of the linearlayout
1条答案
按热度按时间w9apscun1#
可以,您可以从活动创建卡片视图。您可以将以下代码添加到活动中以创建新的卡片视图。
有关详细信息,可以参考有关how to create programmatically CardView的案例