本文整理汇总了Java中it.gmariotti.cardslib.library.internal.Card.addCardHeader方法的典型用法代码示例。如果您正苦于以下问题:Java Card.addCardHeader方法的具体用法?Java Card.addCardHeader怎么用?Java Card.addCardHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.gmariotti.cardslib.library.internal.Card
的用法示例。
在下文中一共展示了Card.addCardHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init_simple_card
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的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);
}
示例2: init_card_inner_layout
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的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);
}
示例3: init_card_without_shadow
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的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);
}
示例4: init_card_custom_shadow_layout
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的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);
}
示例5: init_standard_header_without_buttons
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的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);
}
示例6: init_header_with_custom_inner_layout
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的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);
}
示例7: init_header_with_custom_layout
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的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);
}
示例8: createAddCard
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的package包/类
private void createAddCard() {
//Create new header and set the title
CardHeader addLocationHeader = new CardHeader(this);
addLocationHeader.setTitle("Add New Location");
//Create new card instance
Card addLocation = new Card(this);
//Set thumbnail and drawable resource
CardThumbnail addLocationThumb = new CardThumbnail(this);
addLocationThumb.setDrawableResource(R.drawable.plus);
//Set color
addLocation.setBackgroundResourceId(R.color.darkred);
//Add header
addLocation.addCardHeader(addLocationHeader);
//Add thumbnail
addLocation.addCardThumbnail(addLocationThumb);
//Set clickable
addLocation.setClickable(true);
//Add to arraylist
cards.add(addLocation);
//Set onClick listener
addLocation.setOnClickListener(new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
//Set intent to AddLocation screen
Intent intent = new Intent(MainActivity.this, AddLocationActivity.class);
startActivity(intent);
}
});
}
示例9: createViewCard
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的package包/类
private void createViewCard() {
//Create new header and set the title
CardHeader addLocationHeader = new CardHeader(this);
addLocationHeader.setTitle("View Current Database");
//Create new card instance
Card addLocation = new Card(this);
//Set thumbnail and drawable resource
//CardThumbnail addLocationThumb = new CardThumbnail(this);
//addLocationThumb.setDrawableResource(R.drawable.hacker);
//Set color
addLocation.setBackgroundResourceId(R.color.darkorange);
//Add header
addLocation.addCardHeader(addLocationHeader);
//Add thumbnail
//addLocation.addCardThumbnail(addLocationThumb);
//Set clickable
addLocation.setClickable(true);
//Add to arraylist
cards.add(addLocation);
//Set onClick listener
addLocation.setOnClickListener(new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
//Set intent to AddLocation screen
Intent intent = new Intent(MainActivity.this, ViewLocationsActivity.class);
startActivity(intent);
}
});
}
示例10: onCreate
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的package包/类
/**
* Called when the activity is created. Setup the data
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tasker);
// Show the Up button in the action bar.
setupActionBar();
ArrayList<Card> cards = new ArrayList<Card>();
for (TaskerCommand command : TaskerCommands.getTaskerCommands(this)) {
cards.add(new TaskerCard(this, command));
}
if (cards.size() == 0) {
Card card = new Card(this, R.layout.no_tasker_commands_inner);
CardHeader header = new CardHeader(this);
header.setTitle("No Tasker Commands");
card.addCardHeader(header);
cards.add(card);
}
CardGridArrayAdapter mCardArrayAdapter = new CardGridArrayAdapter(this, cards);
final CardGridView listView = (CardGridView) findViewById(R.id.card_list_view);
animCardArrayAdapter = new SwingBottomInAnimationAdapter(mCardArrayAdapter);
animCardArrayAdapter.setAbsListView(listView);
listView.setExternalAdapter(animCardArrayAdapter, mCardArrayAdapter);
}
示例11: init_standard_header_with_expandcollapse_button
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的package包/类
/**
* This method builds a standard header with base expand/collapse
*/
private void init_standard_header_with_expandcollapse_button() {
//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));
//Set visible the expand/collapse button
header.setButtonExpandVisible(true);
//Add Header to card
card.addCardHeader(header);
//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_expand1);
cardView.setCard(card);
}
示例12: init_cab
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的package包/类
/**
* Card with a CAB
*/
private void init_cab(){
//Create a Card
mCardCab = new Card(getActivity());
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_title_cab1));
mCardCab.addCardHeader(header);
//Set the card inner text
mCardCab.setTitle(getString(R.string.demo_card_basetitle));
//Set onClick listener
mCardCab.setOnLongClickListener(new Card.OnLongCardClickListener() {
@Override
public boolean onLongClick(Card card, View view) {
if (mActionMode != null) {
view.setActivated(false);
mActionMode.finish();
return false;
}
// Start the CAB using the ActionMode.Callback defined above
mActionMode = getActivity().startActionMode(mActionModeCallback);
view.setActivated(true);
return true;
}
});
//Set card in the cardView
cardViewCab = (CardView) getActivity().findViewById(R.id.carddemo_example_card_cab);
cardViewCab.setCard(mCardCab);
}
示例13: init_card_thumb_resourceId
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的package包/类
/**
* This method builds a card with a thumbnail with a resource ID
*/
private void init_card_thumb_resourceId() {
//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));
//Add header to a card
card.addCardHeader(header);
//Create thumbnail
CardThumbnail thumb = new CardThumbnail(getActivity());
//Set ID resource
thumb.setDrawableResource(R.drawable.carddemo_ic_gmaps_large);
//Add thumbnail to a card
card.addCardThumbnail(thumb);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_id);
cardView.setCard(card);
}
示例14: init_card_thumb_resourceURL
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的package包/类
/**
* This method builds a card with a thumbnail with a resource URL
*/
private void init_card_thumb_resourceURL() {
//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);
//Create thumbnail
CardThumbnail thumb = new CardThumbnail(getActivity());
//Set URL resource
thumb.setUrlResource("https://lh5.googleusercontent.com/-N8bz9q4Kz0I/AAAAAAAAAAI/AAAAAAAAAAs/Icl2bQMyK7c/s265-c-k-no/photo.jpg");
//Error Resource ID
thumb.setErrorResource(R.drawable.ic_error_loadingorangesmall);
//Add thumbnail to a card
card.addCardThumbnail(thumb);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_url);
cardView.setCard(card);
}
示例15: init_card_thumb_resourceURL_style
import it.gmariotti.cardslib.library.internal.Card; //导入方法依赖的package包/类
/**
* This method builds a card with a thumbnail with a resource URL with a custom style
*/
private void init_card_thumb_resourceURL_style() {
//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);
//Create thumbnail
CustomThumbCard thumb = new CustomThumbCard(getActivity());
//Set URL resource
thumb.setUrlResource("https://lh5.googleusercontent.com/-N8bz9q4Kz0I/AAAAAAAAAAI/AAAAAAAAAAs/Icl2bQMyK7c/s265-c-k-no/photo.jpg");
//Error Resource ID
thumb.setErrorResource(R.drawable.ic_error_loadingorangesmall);
//Add thumbnail to a card
card.addCardThumbnail(thumb);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_style);
cardView.setCard(card);
}