ActionPage

public class ActionPage
extends ViewGroup

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.support.wearable.view.ActionPage


This class is deprecated.
with Android Wear 2.0 it is recommended to use the androidx.wear.widget.drawer.WearableActionDrawerView for navigation and the ConfirmationOverlay for confirmation actions in particular.

Displays a circular button, with an optional image to perform an action. On round devices the button is centered within the page, and is slightly above center on square devices. An ActionLabel is included centered within the space between the bottom of the button and the bottom of the page, using up to two lines of text if necessary.

Summary

Constants

int SCALE_MODE_CENTER

int SCALE_MODE_FIT

Inherited constants

Inherited fields

Public constructors

ActionPage(Context context)
ActionPage(Context context, AttributeSet attrs)
ActionPage(Context context, AttributeSet attrs, int defStyleAttr)
ActionPage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public methods

WindowInsets onApplyWindowInsets(WindowInsets insets)
void setColor(ColorStateList color)

Sets the colors for the circular button.

void setColor(int color)

Sets the color of the circular button.

void setEnabled(boolean enabled)

Set the enabled state of this view.

void setImageDrawable(Drawable drawable)

Sets an optional image to be displayed on top of the button.

void setImageResource(int drawableRes)

Sets an optional image to be displayed on top of the button.

void setImageScaleMode(int scaleMode)

Sets the scaling mode used for the optional image.

void setOnClickListener(View.OnClickListener l)

Register a callback to be invoked when the circular button is clicked.

void setStateListAnimator(StateListAnimator stateListAnimator)

Attaches the provided StateListAnimator to the circular button.

void setText(CharSequence text)

Sets the text of the action label.

Protected methods

void onAttachedToWindow()
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Inherited methods

Constants

SCALE_MODE_CENTER

public static final int SCALE_MODE_CENTER

Constant Value: 1 (0x00000001)

SCALE_MODE_FIT

public static final int SCALE_MODE_FIT

Constant Value: 0 (0x00000000)

Public constructors

ActionPage

public ActionPage (Context context)

Parameters
context Context

ActionPage

public ActionPage (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

ActionPage

public ActionPage (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

ActionPage

public ActionPage (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

Public methods

onApplyWindowInsets

public WindowInsets onApplyWindowInsets (WindowInsets insets)

Parameters
insets WindowInsets

Returns
WindowInsets

setColor

public void setColor (ColorStateList color)

Sets the colors for the circular button.

Parameters
color ColorStateList

setColor

public void setColor (int color)

Sets the color of the circular button.

Parameters
color int

setEnabled

public void setEnabled (boolean enabled)

Set the enabled state of this view. The interpretation of the enabled state varies by subclass.

Parameters
enabled boolean: True if this view is enabled, false otherwise.

setImageDrawable

public void setImageDrawable (Drawable drawable)

Sets an optional image to be displayed on top of the button.

Parameters
drawable Drawable

setImageResource

public void setImageResource (int drawableRes)

Sets an optional image to be displayed on top of the button.

Parameters
drawableRes int

setImageScaleMode

public void setImageScaleMode (int scaleMode)

Sets the scaling mode used for the optional image.

Must be one of:

SCALE_MODE_CENTER
Center the image within the button and draw without any scaling.
SCALE_MODE_FIT
Draw the image scaled to fit within the circular button.

Parameters
scaleMode int

setOnClickListener

public void setOnClickListener (View.OnClickListener l)

Register a callback to be invoked when the circular button is clicked. If it is not clickable, it becomes clickable.

Parameters
l View.OnClickListener: The callback that will run

setStateListAnimator

public void setStateListAnimator (StateListAnimator stateListAnimator)

Attaches the provided StateListAnimator to the circular button.

Any previously attached StateListAnimator will be detached.

Parameters
stateListAnimator StateListAnimator: The StateListAnimator to update the view

See also:

setText

public void setText (CharSequence text)

Sets the text of the action label.

Parameters
text CharSequence

Protected methods

onAttachedToWindow

protected void onAttachedToWindow ()

onLayout

protected void onLayout (boolean changed, 
                int l, 
                int t, 
                int r, 
                int b)

Parameters
changed boolean

l int

t int

r int

b int

onMeasure

protected void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Parameters
widthMeasureSpec int

heightMeasureSpec int