CircularButton

public class CircularButton
extends View

java.lang.Object
   ↳ android.view.View
     ↳ android.support.wearable.view.CircularButton


This class is deprecated.
consider using the Floating Action Button instead.

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

Inherited constants

Inherited fields

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(ColorStateList colorStateList)

Sets the background color of the circular button.

void setColor(int color)

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)

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

CircularButton

public CircularButton (Context context)

Parameters
context Context

CircularButton

public CircularButton (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

CircularButton

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

Parameters
context Context

attrs AttributeSet

defStyleAttr int

CircularButton

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

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

Public methods

getImageDrawable

public Drawable getImageDrawable ()

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

Returns
Drawable

getImageScaleMode

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.

Returns
int

onTouchEvent

public boolean onTouchEvent (MotionEvent event)

Parameters
event MotionEvent

Returns
boolean

setBackgroundDrawable

public void setBackgroundDrawable (Drawable background)

Parameters
background Drawable

setColor

public void setColor (ColorStateList colorStateList)

Sets the background color of the circular button.

Parameters
colorStateList ColorStateList

setColor

public void setColor (int color)

Sets the background color of the circular button.

Parameters
color int

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 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

setPressedTranslationZ

public void setPressedTranslationZ (float translationZ)

Parameters
translationZ float

setRippleColor

public void setRippleColor (int rippleColor)

Parameters
rippleColor int

Protected methods

drawableStateChanged

protected void drawableStateChanged ()

onDraw

protected void onDraw (Canvas canvas)

Parameters
canvas Canvas

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

verifyDrawable

protected boolean verifyDrawable (Drawable who)

Parameters
who Drawable

Returns
boolean