Note: The Wearable Support Library classes under the android.support.wearable
package are subject to change. For the full Android API reference, see Reference.
java.lang.Object | ||
↳ | android.app.Fragment | |
↳ | android.support.wearable.view.CardFragment |
Presents content within an expandable, vertically scrollable card. The default layout contains a
title, icon and text, but may be replaced by overriding
onCreateContentView(LayoutInflater, ViewGroup, Bundle)
.
Additional methods are supplied for adjusting the appearance of the card, including whether content should clip or appear as expandable, and the maximum height of the card.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | EXPAND_DOWN | ||||||||||
int | EXPAND_UP | ||||||||||
String | KEY_ICON_RESOURCE | ||||||||||
String | KEY_TEXT | ||||||||||
String | KEY_TITLE |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.content.ComponentCallbacks2
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct a new CardFragment using the default content layout.
| |||||||||||
Construct a new CardFragment using the default content layout, including and icon.
| |||||||||||
Gets the padding between the inside card edge and the card content.
| |||||||||||
Gets the padding between the inside card's bottom edge and the card content.
| |||||||||||
Gets the padding between the inside card's left edge and the card content.
| |||||||||||
Gets the padding between the inside card's right edge and the card content.
| |||||||||||
Gets the padding between the inside card's top edge and the card content.
| |||||||||||
Called to have subclasses instantiate their layout which is inserted within the card.
| |||||||||||
Sets the card scroll position as far down as possible so the bottom edge is visible.
| |||||||||||
Sets the card scroll position as far up as possible so the top edge is visible.
| |||||||||||
Assigns vertical gravity to the card, which determines where it should float when the card
and it's content are shorter than the page.
| |||||||||||
Sets the additional margin between the bottom edge of the card shadow, and the parent view.
| |||||||||||
Sets the additional margin between the left edge of the card shadow, and the parent view.
| |||||||||||
Sets the additional margin between the right edge of the card shadow, and the parent view.
| |||||||||||
Sets the additional margin between the top edge of the card shadow, and the parent view.
| |||||||||||
Sets the additional margin between the card shadow edge and the parent view.
| |||||||||||
Sets padding between the inside card edge and the card content.
| |||||||||||
Sets the padding between the inside card's bottom edge and the card content.
| |||||||||||
Sets the padding between the inside card's left edge and the card content.
| |||||||||||
Sets the padding between the inside card's right edge and the card content.
| |||||||||||
Sets the padding between the inside card's top edge and the card content.
| |||||||||||
Adjusts which direction the card height will expand.
| |||||||||||
Enables support contents which maybe be larger than the card's container.
| |||||||||||
Sets the allowed maximum height of the card as a multiple of the parent height.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Fragment
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.content.ComponentCallbacks2
| |||||||||||
From interface
android.view.View.OnCreateContextMenuListener
| |||||||||||
From interface
android.content.ComponentCallbacks
|
Construct a new CardFragment using the default content layout.
title | the card title displayed on the first line |
---|---|
description | the card text displayed below the title |
Construct a new CardFragment using the default content layout, including and icon.
title | the card title displayed on the first line |
---|---|
text | the card text displayed below the title |
iconRes | a resourceId for an icon to be displayed next to the title |
Gets the padding between the inside card edge and the card content.
Gets the padding between the inside card's bottom edge and the card content.
Gets the padding between the inside card's left edge and the card content.
Gets the padding between the inside card's right edge and the card content.
Gets the padding between the inside card's top edge and the card content.
Called to have subclasses instantiate their layout which is inserted within the card. Override this method to supply your own custom layout for the card content.
inflater | The LayoutInflater object that can be used to inflate any views in the fragment |
---|---|
container | If non-null, this is the parent view that the fragment's UI should be attached to. The fragment should not add the view itself, but this can be used to generate the LayoutParams of the view |
savedInstanceState | If non-null, this fragment is being re-constructed from a previous saved state as given here |
Sets the card scroll position as far down as possible so the bottom edge is visible.
Sets the card scroll position as far up as possible so the top edge is visible.
Sets the additional margin between the bottom edge of the card shadow, and the parent view.
bottom | the top margin |
---|
Sets the additional margin between the left edge of the card shadow, and the parent view.
left | the top margin |
---|
Sets the additional margin between the right edge of the card shadow, and the parent view.
right | the top margin |
---|
Sets the additional margin between the top edge of the card shadow, and the parent view.
top | the top margin |
---|
Sets the additional margin between the card shadow edge and the parent view.
left | the left margin |
---|---|
top | the top margin |
right | the right margin |
bottom | the bottom margin |
Sets padding between the inside card edge and the card content.
left | the left padding |
---|---|
top | the top padding |
right | the right padding |
bottom | the bottom padding |
Sets the padding between the inside card's bottom edge and the card content.
bottomPadding | the bottom padding |
---|
Sets the padding between the inside card's left edge and the card content.
leftPadding | the left padding |
---|
Sets the padding between the inside card's right edge and the card content.
rightPadding | the right padding |
---|
Sets the padding between the inside card's top edge and the card content.
Adjusts which direction the card height will expand. This also determines which edge is rendered with a faded edge when more content is available by scrolling.
direction | a direction constant, either EXPAND_UP or EXPAND_DOWN
|
---|
Enables support contents which maybe be larger than the card's container. When expansion is enabled, and the contents are larger than the card, the top or bottom edge will fade to indicate this. The expansion factor must also be increased to allow the card to increase in height.
Sets the allowed maximum height of the card as a multiple of the parent height. If expansion is enabled, The card will increase in height up to this amount as needed to accommodate content.
factor | the vertical height multiplier to set the maximum height |
---|