|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectFragment
android.support.wearable.view.CardFragment
public class 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.
setCardGravity(int),
setExpansionEnabled(boolean),
setExpansionDirection(int),
setExpansionFactor(float)| Field Summary | |
|---|---|
static int |
EXPAND_DOWN
|
static int |
EXPAND_UP
|
static java.lang.String |
KEY_ICON_RESOURCE
|
static java.lang.String |
KEY_TEXT
|
static java.lang.String |
KEY_TITLE
|
| Constructor Summary | |
|---|---|
CardFragment()
|
|
| Method Summary | |
|---|---|
static CardFragment |
create(java.lang.CharSequence title,
java.lang.CharSequence description)
Construct a new CardFragment using the default content layout. |
static CardFragment |
create(java.lang.CharSequence title,
java.lang.CharSequence text,
int iconRes)
Construct a new CardFragment using the default content layout, including and icon. |
View |
onCreateContentView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
Called to have subclasses instantiate their layout which is inserted within the card. |
View |
onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
|
void |
onResume()
|
void |
scrollToBottom()
Sets the card scroll position as far down as possible so the bottom edge is visible. |
void |
scrollToTop()
Sets the card scroll position as far up as possible so the top edge is visible. |
void |
setCardGravity(int gravity)
Assigns vertical gravity to the card, which determines where it should float when the card and it's content are shorter than the page. |
void |
setExpansionDirection(int direction)
Adjusts which direction the card height will expand. |
void |
setExpansionEnabled(boolean enabled)
Enables support contents which maybe be larger than the card's container. |
void |
setExpansionFactor(float factor)
Sets the allowed maximum height of the card as a multiple of the parent height. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int EXPAND_UP
public static final int EXPAND_DOWN
public static final java.lang.String KEY_TITLE
public static final java.lang.String KEY_TEXT
public static final java.lang.String KEY_ICON_RESOURCE
| Constructor Detail |
|---|
public CardFragment()
| Method Detail |
|---|
public static CardFragment create(java.lang.CharSequence title,
java.lang.CharSequence description)
title - the card title displayed on the first linedescription - the card text displayed below the title
public static CardFragment create(java.lang.CharSequence title,
java.lang.CharSequence text,
int iconRes)
title - the card title displayed on the first linetext - the card text displayed below the titleiconRes - a resourceId for an icon to be displayed next to the title
public void setExpansionEnabled(boolean enabled)
public void setExpansionDirection(int direction)
direction - a direction constant, either EXPAND_UP or EXPAND_DOWNpublic void setCardGravity(int gravity)
gravity - a vertical gravity, either Gravity#TOP or Gravity#BOTTOMpublic void setExpansionFactor(float factor)
factor - the vertical height multiplier to set the maximum heightpublic void scrollToTop()
public void scrollToBottom()
public final View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
public void onResume()
public View onCreateContentView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
inflater - The LayoutInflater object that can be used to inflate any views in the
fragmentcontainer - 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 viewsavedInstanceState - If non-null, this fragment is being re-constructed from a previous
saved state as given here
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||