public class

CircularButton

extends View

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.view.View
     ↳ android.support.wearable.view.CircularButton

Class Overview

A circular button in the style of a Floating Action Button, with support for ripple touch effects and elevation animation.

Summary

Constants
int SCALE_MODE_CENTER
int SCALE_MODE_FIT
[Expand]
Inherited Constants
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
CircularButton(Context context)
CircularButton(Context context, AttributeSet attrs)
CircularButton(Context context, AttributeSet attrs, int defStyleAttr)
CircularButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
Drawable getImageDrawable()
Returns the optional image to displayed on top of the button.
int getImageScaleMode()
Returns the scaling mode used for the image.
boolean onTouchEvent(MotionEvent event)
void setBackgroundDrawable(Drawable background)
void setColor(int color)
Sets the background color of the circular button.
void setColor(ColorStateList colorStateList)
Sets the background color of the circular button.
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 image.
void setPressedTranslationZ(float translationZ)
void setRippleColor(int rippleColor)
Protected Methods
void drawableStateChanged()
void onDraw(Canvas canvas)
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
boolean verifyDrawable(Drawable who)
[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 SCALE_MODE_CENTER

Constant Value: 1 (0x00000001)

public static final int SCALE_MODE_FIT

Constant Value: 0 (0x00000000)

Public Constructors

public CircularButton (Context context)

public CircularButton (Context context, AttributeSet attrs)

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

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

Public Methods

public Drawable getImageDrawable ()

Returns the optional image to displayed on top of the button.

public int getImageScaleMode ()

Returns the scaling mode used for the image.

Value is 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.

public boolean onTouchEvent (MotionEvent event)

public void setBackgroundDrawable (Drawable background)

public void setColor (int color)

Sets the background color of the circular button.

public void setColor (ColorStateList colorStateList)

Sets the background color of the circular button.

public void setImageDrawable (Drawable drawable)

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

public void setImageResource (int drawableRes)

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

public void setImageScaleMode (int scaleMode)

Sets the scaling mode used for the 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.

public void setPressedTranslationZ (float translationZ)

public void setRippleColor (int rippleColor)

Protected Methods

protected void drawableStateChanged ()

protected void onDraw (Canvas canvas)

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

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

protected boolean verifyDrawable (Drawable who)