public class

ActionChooserView

extends View
java.lang.Object
   ↳ android.view.View
     ↳ android.support.wearable.view.ActionChooserView

Class Overview

The action chooser view allows the user to select from two options that are presented in the sides of the view. The view background is transparent so that it may be populated by the containing parent.

You can add this view to your layout as follows:

     <android.support.wearable.view.ActionChooserView
          android:id="@+id/actions"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />
 

To set the properties of either option, you can call setOption(int, Drawable, int), specifying OPTION_START for the option at the start and OPTION_END for the option at the end:

mChooserView.setOption(ActionChooserView.OPTION_START, acceptIcon, getResources().getColor( R.color.option_color));

Summary

Nested Classes
interface ActionChooserView.ActionChooserListener Interface for receiving callbacks about options chosen from an ActionChooserView
Constants
int OPTION_END The option that appears at the end of the chooser.
int OPTION_START The option that appears at the start of the chooser.
[Expand]
Inherited Constants
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
ActionChooserView(Context context)
ActionChooserView(Context context, AttributeSet attrs)
ActionChooserView(Context context, AttributeSet attrs, int defStyleAttr)
Public Methods
void addListener(ActionChooserView.ActionChooserListener listener)
Adds a listener to be notified when an option is chosen.
boolean canScrollHorizontally(int direction)
boolean onTouchEvent(MotionEvent event)
void performSelectOption(int option)
Selects the provided option, animating the option's icon to the center of the view and triggering the appropriate callbacks.
void removeListener(ActionChooserView.ActionChooserListener listener)
Removes a listener from receiving any future callbacks when an option is chosen.
void setEnabled(boolean enabled)
void setOption(int option, Drawable drawable, int color)
Sets the characteristics of one of the predefined options, such as the option circle's color and the Drawable to be drawn in the middle.
Protected Methods
void onAttachedToWindow()
void onDetachedFromWindow()
void onDraw(Canvas canvas)
void onLayout(boolean changed, int left, int top, int right, int bottom)
[Expand]
Inherited Methods
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Constants

public static final int OPTION_END

The option that appears at the end of the chooser.

Constant Value: 2 (0x00000002)

public static final int OPTION_START

The option that appears at the start of the chooser.

Constant Value: 1 (0x00000001)

Public Constructors

public ActionChooserView (Context context)

public ActionChooserView (Context context, AttributeSet attrs)

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

Public Methods

public void addListener (ActionChooserView.ActionChooserListener listener)

Adds a listener to be notified when an option is chosen. see onOptionChosen(int)

Parameters
listener The listener to add.

public boolean canScrollHorizontally (int direction)

public boolean onTouchEvent (MotionEvent event)

public void performSelectOption (int option)

Selects the provided option, animating the option's icon to the center of the view and triggering the appropriate callbacks.

Parameters
option The option to select, either OPTION_START or OPTION_END.

public void removeListener (ActionChooserView.ActionChooserListener listener)

Removes a listener from receiving any future callbacks when an option is chosen.

Parameters
listener The listener to remove.

public void setEnabled (boolean enabled)

public void setOption (int option, Drawable drawable, int color)

Sets the characteristics of one of the predefined options, such as the option circle's color and the Drawable to be drawn in the middle.

Parameters
option The option to set, either OPTION_START or OPTION_END.
drawable The drawable to draw in the center of the option circle.
color The color of the option circle.

Protected Methods

protected void onAttachedToWindow ()

protected void onDetachedFromWindow ()

protected void onDraw (Canvas canvas)

protected void onLayout (boolean changed, int left, int top, int right, int bottom)