本文整理汇总了Java中it.gmariotti.cardslib.library.internal.CardArrayAdapter.setInnerViewTypeCount方法的典型用法代码示例。如果您正苦于以下问题:Java CardArrayAdapter.setInnerViewTypeCount方法的具体用法?Java CardArrayAdapter.setInnerViewTypeCount怎么用?Java CardArrayAdapter.setInnerViewTypeCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.gmariotti.cardslib.library.internal.CardArrayAdapter
的用法示例。
在下文中一共展示了CardArrayAdapter.setInnerViewTypeCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initCards
import it.gmariotti.cardslib.library.internal.CardArrayAdapter; //导入方法依赖的package包/类
private void initCards() {
ArrayList<Card> cards = new ArrayList<Card>();
for (int i=0;i<50;i++){
CardExample card = new CardExample(getActivity(),"My title "+i,"Inner text "+i);
cards.add(card);
CardExample2 cardx = new CardExample2(this.getActivity());
cardx.title="Application example "+i;
cardx.secondaryTitle="A company inc..."+i;
cardx.rating=(float)(Math.random()*(5.0));
cardx.count=i;
cards.add(cardx);
MayKnowCard card2= new MayKnowCard(getActivity());
card2.setType(2); //Very important with different inner layout
card2.setSwipeable(true);
cards.add(card2);
}
// Provide a custom adapter.
// It is important to set the viewTypeCount
// You have to provide in your card the type value with {@link Card#setType(int)} method.
CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(),cards);
mCardArrayAdapter.setInnerViewTypeCount(3);
// An alternative is to write a own CardArrayAdapter
// MyCardArrayAdapter mCardArrayAdapter = new MyCardArrayAdapter(getActivity(),cards);
CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_base1);
if (listView!=null){
listView.setAdapter(mCardArrayAdapter);
}
}