当我通过点击卡片/展开按钮来切换扩展时,整张卡片会在很短的时间内消失并再次出现。它发生在扩展动画的末尾。
查看操作中的问题:https://dl.dropboxusercontent.com/u/10116108/Cardslib_flicker.gif
我尝试使用标准扩展而不是相同的结果。所以它不能是我的CustomExpandCard(这就是我没有发布代码的原因)。
这是我创建卡片的代码:
//Create a Card
Card card = new Card(getActivity(), R.layout.card_inner_content);
ViewToClickToExpand viewToClickToExpand =
ViewToClickToExpand.builder()
.highlightView(false)
.setupCardElement(ViewToClickToExpand.CardElementUI.CARD);
card.setViewToClickToExpand(viewToClickToExpand);
//Set onClick listener
card.setOnClickListener(new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
card.doToogleExpand();
}
});
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
header.setTitle(entry.getValue().toString());
//Set visible the expand/collapse button
header.setButtonExpandVisible(true);
CardExpand expand = new CustomExpandCard(getActivity());
card.addCardExpand(expand);
//Add Header to card
card.addCardHeader(header);
card.setTitle(quote);
//Card elevation
card.setCardElevation(getResources().getDimension(R.dimen.carddemo_shadow_elevation));
card.setId(String.valueOf(index));
cards.add(card);
稍后我更新了recyclerView:
mCardArrayAdapter = new CardArrayRecyclerViewAdapter(getActivity(), cards);
mRecyclerView.setAdapter(mCardArrayAdapter);