本文整理汇总了Java中it.gmariotti.cardslib.library.view.CardView类的典型用法代码示例。如果您正苦于以下问题:Java CardView类的具体用法?Java CardView怎么用?Java CardView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CardView类属于it.gmariotti.cardslib.library.view包,在下文中一共展示了CardView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeOverflowIconSelection
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* Internal method to change the state of overflow icon on the view and on the model
*
* @param selected
*/
protected void changeOverflowIconSelection(boolean selected){
if (mCard==null) return;
//Change the value on the card and inside
CardHeader header = mCard.getCardHeader();
if (header!=null){
this.selected=selected;
header.setOverflowSelected(selected);
}
//Change the imageButton state
CardView cardView = mCard.getCardView();
if (cardView!=null){
if (cardView.getInternalHeaderLayout()!=null && cardView.getInternalHeaderLayout().getImageButtonOverflow()!=null)
cardView.getInternalHeaderLayout().getImageButtonOverflow().setSelected(selected);
}
}
示例2: getVisibleViewsForCards
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* Returns the visible view for the cards
*
* @param cardsCopy
* @return
*/
private List<CardView> getVisibleViewsForCards(List<Card> cardsCopy) {
List<CardView> originalViews = new ArrayList<CardView>();
for (Card card:cardsCopy){
originalViews.add(card.getCardView());
}
/*List<CardView> views = new ArrayList<CardView>();
for (int i = 0; i < mCardListView.getChildCount(); i++) {
View child = mCardListView.getChildAt(i);
if (cardsCopy.contains(views)){
views.add((CardView) child);
}
}*/
return originalViews;
}
示例3: setItemChecked
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* Set card checked state and update the internal state
*
* @param card CardView object whose state is to be updated
* @param value Checked or not
*/
public void setItemChecked(CardView card, boolean value) {
int id = Integer.parseInt(card.getCard().getId());
card.setSelected(value);
card.setActivated(value);
// update the array containing ids of checked cards
if (value) {
mCheckedIds.put(id, true);
} else {
mCheckedIds.delete(id);
}
// To force redrawing the actionbar view and show updated number of
// selected items
if (mMultiChoiceCallback != null && mMultiChoiceCallback.isActionModeActive()) {
mMultiChoiceCallback.getActionMode().invalidate();
}
}
示例4: initCardMayKnow
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a simple card
*/
private void initCardMayKnow() {
//Create a Card
MayKnowCard card= new MayKnowCard(getActivity());
card.setShadow(false);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_MayKnow);
cardView.setCard(card);
MayKnowCard card2 = new MayKnowCard(getActivity());
card2.addCardHeader(null);
card2.setShadow(true);
CardView mayView2 = (CardView) getActivity().findViewById(R.id.carddemo_MayKnow2);
mayView2.setCard(card2);
}
示例5: init_custom_card_expand
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a custom card with expand/collapse action clickable in all card view
*/
private void init_custom_card_expand() {
//Create a Card
CustomCard card = new CustomCard(getActivity());
//This provides a simple (and useless) expand area
CardExpand expand = new CardExpand(getActivity());
//Set inner title in Expand Area
expand.setTitle(getString(R.string.demo_expand_customtitle3));
card.addCardExpand(expand);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand2);
ViewToClickToExpand viewToClickToExpand =
ViewToClickToExpand.builder()
.setupView(cardView);
card.setViewToClickToExpand(viewToClickToExpand);
cardView.setCard(card);
}
示例6: init_custom_card_expand_clicking_text
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a custom card with expand/collapse action clickable in all card view
*/
private void init_custom_card_expand_clicking_text() {
//Create a Card
CustomCard2 card = new CustomCard2(getActivity());
card.setTitle("Click here to expand/collapse");
//This provides a simple (and useless) expand area
CardExpand expand = new CardExpand(getActivity());
//Set inner title in Expand Area
expand.setTitle(getString(R.string.demo_expand_customtitle3));
card.addCardExpand(expand);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand3);
cardView.setCard(card);
}
示例7: init_custom_card_expand_clicking_image
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a custom card with expand/collapse action clickable in all card view
*/
private void init_custom_card_expand_clicking_image() {
//Create a Card
Card card = new Card(getActivity());
//This provides a simple (and useless) expand area
CardExpand expand = new CardExpand(getActivity());
//Set inner title in Expand Area
expand.setTitle(getString(R.string.demo_expand_customtitle3));
card.addCardExpand(expand);
CustomThumbnail thumb = new CustomThumbnail(getActivity());
thumb.setDrawableResource(R.drawable.ic_smile);
card.addCardThumbnail(thumb);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand4);
cardView.setCard(card);
}
示例8: init_simple_card
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a simple card
*/
private void init_simple_card() {
//Create a Card
Card card = new Card(getActivity());
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
card.addCardHeader(header);
//Set the card inner text
card.setTitle(getString(R.string.demo_card_basetitle));
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_card_id);
cardView.setCard(card);
}
示例9: init_card_inner_layout
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a simple card with a custom inner layout
*/
private void init_card_inner_layout() {
//Create a Card
Card card = new Card(getActivity(),R.layout.carddemo_example_inner_content);
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
card.addCardHeader(header);
//Set the card inner text
card.setTitle(getString(R.string.demo_card_basetitle));
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_card_inner);
cardView.setCard(card);
}
示例10: init_card_without_shadow
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a card without shadow
*/
private void init_card_without_shadow() {
//Create a Card
Card card = new Card(getActivity());
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
card.addCardHeader(header);
//Hidden shadow
card.setShadow(false);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_shadow_no);
cardView.setCard(card);
}
示例11: init_card_custom_shadow_layout
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This methods builds a card with a custom shadow layout (compound view)
* <b>WARNING</b>
* See https://github.com/gabrielemariotti/cardslib/tree/master/SHADOW.md for more information.
* You can quickly modify your shadow with your style and drawable files without modifying shadow layout.
*/
private void init_card_custom_shadow_layout() {
//Create a Card
Card card = new Card(getActivity());
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
card.addCardHeader(header);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_shadow_layout);
cardView.setCard(card);
}
示例12: init_standard_header_without_buttons
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a standard header without buttons
*/
private void init_standard_header_without_buttons() {
//Create a Card
Card card = new Card(getActivity());
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
card.addCardHeader(header);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_header_std);
cardView.setCard(card);
}
示例13: init_header_with_custom_inner_layout
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a header with custom inner layout
*/
private void init_header_with_custom_inner_layout() {
//Create a Card
Card card = new Card(getActivity());
//Create a CardHeader
CustomHeaderInnerCard header = new CustomHeaderInnerCard(getActivity());
//Add Header to card
card.addCardHeader(header);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_header_inner);
cardView.setCard(card);
}
示例14: init_header_with_custom_layout
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
/**
* This method builds a header with full custom layout
*/
private void init_header_with_custom_layout() {
//Create a Card
Card card = new Card(getActivity());
//Create a CardHeader
CustomHeaderExample1 header = new CustomHeaderExample1(getActivity());
//Add Header to card
card.addCardHeader(header);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_header_layout);
cardView.setCard(card);
}
示例15: setupInnerViewElements
import it.gmariotti.cardslib.library.view.CardView; //导入依赖的package包/类
@Override
public void setupInnerViewElements(ViewGroup parent, View view) {
TextView title = (TextView) view.findViewById(R.id.carddemo_mayknow_main_inner_title);
TextView subtitle = (TextView) view.findViewById(R.id.carddemo_mayknow_main_inner_subtitle);
TextView add = (TextView) view.findViewById(R.id.carddemo_mayknow_main_inner_button);
title.setText(getContext().getString(R.string.may_know_card_inner_title));
subtitle.setText(getContext().getString(R.string.may_know_card_inner_subtitle));
add.setClickable(true);
CardView cardView = getCardView();
CardThumbnailView thumb = cardView.getInternalThumbnailLayout();
if (thumb != null) {
ViewGroup.LayoutParams lp = thumb.getLayoutParams();
if (lp instanceof ViewGroup.MarginLayoutParams) {
((ViewGroup.MarginLayoutParams) lp).setMargins(25, 0, 0, 5);
}
}
}