Skip to content

Most visited

Recently visited

navigation

ComplicationDrawable

public class ComplicationDrawable
extends Drawable

java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ android.support.wearable.complications.rendering.ComplicationDrawable


A styleable drawable object that draws complications. You can create a ComplicationDrawable from XML inflation or by using one of the constructor methods.

Constructing a ComplicationDrawable

To construct a ComplicationDrawable programmatically, use the ComplicationDrawable(Context) constructor. Afterwards, styling attributes you want to modify can be set via set methods.

 public void onCreate(SurfaceHolder holder) {
   ...
   ComplicationDrawable complicationDrawable = new ComplicationDrawable(getApplicationContext());
   complicationDrawable.setBackgroundColorActive(backgroundColor);
   complicationDrawable.setTextColorActive(textColor);
   ...
 }

Constructing a ComplicationDrawable from XML

Constructing a ComplicationDrawable from an XML file makes it easier to modify multiple styling attributes at once without calling any set methods. You may also use different XML files to switch between different styles your watch face supports.

To construct a ComplicationDrawable from a drawable XML file, you may create an XML file in your project's res/drawable folder. A ComplicationDrawable with red text and white title in active mode, and white text and white title in ambient mode would look like this:

 <?xml version="1.0" encoding="utf-8"?>
 <android.support.wearable.complications.rendering.ComplicationDrawable
   xmlns:app="http://schemas.android.com/apk/res-auto"
   app:textColor="#FFFF0000"
   app:titleColor="#FFFFFFFF">
   <ambient
     app:textColor="#FFFFFFFF" />
 </android.support.wearable.complications.rendering.ComplicationDrawable>

A top-level drawable tag with the class attribute may also be used to construct a ComplicationDrawable from an XML file:

 <?xml version="1.0" encoding="utf-8"?>
 <drawable
   class="android.support.wearable.complications.rendering.ComplicationDrawable"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   app:textColor="#FFFF0000"
   app:titleColor="#FFFFFFFF">
   <ambient
     app:textColor="#FFFFFFFF" />
 </drawable>

Attributes of the top-level tag apply to both active and ambient modes while attributes of the inner ambient tag only apply to ambient mode.

To inflate a ComplicationDrawable from XML file, use the getDrawable(int) method. After loading the ComplicationDrawable, you should call setContext(Context) right after. ComplicationDrawable needs access to the current context in order to style and draw the complication.

 public void onCreate(SurfaceHolder holder) {
   ...
   ComplicationDrawable complicationDrawable = (ComplicationDrawable)
       getDrawable(R.drawable.complication);
   complicationDrawable.setContext(getApplicationContext());
   ...
 }

Syntax:

 <?xml version="1.0" encoding="utf-8"?>
 <android.support.wearable.complications.rendering.ComplicationDrawable
   xmlns:app="http://schemas.android.com/apk/res-auto"
   app:backgroundColor="color"
   app:backgroundDrawable="drawable"
   app:borderColor="color"
   app:borderDashGap="dimension"
   app:borderDashWidth="dimension"
   app:borderRadius="dimension"
   app:borderStyle="none|solid|dashed"
   app:borderWidth="dimension"
   app:highlightColor="color"
   app:iconColor="color"
   app:rangedValuePrimaryColor="color"
   app:rangedValueRingWidth="dimension"
   app:rangedValueSecondaryColor="color"
   app:textColor="color"
   app:textSize="dimension"
   app:textTypeface="string"
   app:titleColor="color"
   app:titleSize="dimension"
   app:titleTypeface="string">
   <ambient
     app:backgroundColor="color"
     app:backgroundDrawable="drawable"
     app:borderColor="color"
     app:borderDashGap="dimension"
     app:borderDashWidth="dimension"
     app:borderRadius="dimension"
     app:borderStyle="none|solid|dashed"
     app:borderWidth="dimension"
     app:highlightColor="color"
     app:iconColor="color"
     app:rangedValuePrimaryColor="color"
     app:rangedValueRingWidth="dimension"
     app:rangedValueSecondaryColor="color"
     app:textColor="color"
     app:textSize="dimension"
     app:textTypeface="string"
     app:titleColor="color"
     app:titleSize="dimension"
     app:titleTypeface="string" />
 </android.support.wearable.complications.rendering.ComplicationDrawable>

Updating complication data

When onComplicationDataUpdate(int, ComplicationData) is called, you should call the setComplicationData(ComplicationData) method to update ComplicationData drawn by this ComplicationDrawable.

 public void onComplicationDataUpdate(int id, ComplicationData data) {
   mComplicationDrawable.setComplicationData(data);
 }

Going in and out of ambient mode

When onAmbientModeChanged(boolean) is called, you should call the setInAmbientMode(boolean) method to update the styling of ComplicationDrawable.

 public void onAmbientModeChanged(boolean inAmbientMode) {
   mComplicationDrawable.setInAmbientMode(inAmbientMode);
 }

Updating ambient properties

When the onPropertiesChanged(android.os.Bundle) method is called, you should call the setLowBitAmbient(boolean) and setBurnInProtection(boolean) methods to update ambient properties of the ComplicationDrawable. These properties will be used to decide if antialiasing should be enabled or if images should be drawn in ambient mode.

 public void onPropertiesChanged(Bundle properties) {
   mComplicationDrawable.setLowBitAmbient(
     properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false));
   mComplicationDrawable.setBurnInProtection(
     properties.getBoolean(PROPERTY_BURN_IN_PROTECTION, false));
 }
 

Drawing a ComplicationDrawable

Before calling the draw(Canvas, long) method in your WatchFaceService, you should call setBounds(Rect) to update the position and size of the ComplicationDrawable within the watch face canvas. The setBounds(Rect) method only needs to be called on the first draw or if the bounds change.

 public void onDraw(Canvas canvas, Rect bounds) {
   ...
   if (haveChanged(bounds)) {
     mComplicationDrawable.setBounds(complicationBoundsWithin(bounds));
   }
   mComplicationDrawable.draw(canvas, currentTimeMillis);
   ...
 }

Depending on the size and shape of the bounds, the layout of the complication may change. For instance, a short text complication with an icon that is drawn on square bounds would draw the icon above the short text, but a short text complication with an icon that is drawn on wide rectangular bounds might draw the icon to the left of the short text instead.

Summary

Nested classes

@interface ComplicationDrawable.BorderStyle

Constants used to define border styles for complications. 

XML attributes

android.support.wearable:backgroundColor  
android.support.wearable:backgroundDrawable  
android.support.wearable:borderColor  
android.support.wearable:borderDashGap  
android.support.wearable:borderDashWidth  
android.support.wearable:borderRadius  
android.support.wearable:borderStyle  
android.support.wearable:borderWidth  
android.support.wearable:highlightColor  
android.support.wearable:iconColor  
android.support.wearable:rangedValuePrimaryColor  
android.support.wearable:rangedValueRingWidth  
android.support.wearable:rangedValueSecondaryColor  
android.support.wearable:textColor  
android.support.wearable:textSize  
android.support.wearable:textTypeface  
android.support.wearable:titleColor  
android.support.wearable:titleSize  
android.support.wearable:titleTypeface  

Constants

int BORDER_STYLE_DASHED

Style where the borders are drawn as dashed lines.

int BORDER_STYLE_NONE

Style where the borders are not drawn.

int BORDER_STYLE_SOLID

Style where the borders are drawn without any gap.

Public constructors

ComplicationDrawable()

Default constructor.

ComplicationDrawable(Context context)

Creates a ComplicationDrawable using the given context.

Public methods

void draw(Canvas canvas)

Draws the complication for the last known time.

void draw(Canvas canvas, long currentTimeMillis)

Draws the complication into bounds set via setBounds(Rect) for the given time.

int getOpacity()
void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)

Inflates this ComplicationDrawable from an XML resource.

void setAlpha(int alpha)

Does nothing.

void setBackgroundColorActive(int backgroundColor)

Sets the background color used in active mode.

void setBackgroundColorAmbient(int backgroundColor)

Sets the background color used in ambient mode.

void setBackgroundDrawableActive(Drawable drawable)

Sets the background drawable used in active mode.

void setBackgroundDrawableAmbient(Drawable drawable)

Sets the background drawable used in ambient mode.

void setBorderColorActive(int borderColor)

Sets the border color used in active mode.

void setBorderColorAmbient(int borderColor)

Sets the border color used in ambient mode.

void setBorderDashGapActive(int borderDashGap)

Sets the dash gap used in active mode when drawing borders with style BORDER_STYLE_DASHED.

void setBorderDashGapAmbient(int borderDashGap)

Sets the dash gap used in ambient mode when drawing borders with style BORDER_STYLE_DASHED.

void setBorderDashWidthActive(int borderDashWidth)

Sets the dash width used in active mode when drawing borders with style BORDER_STYLE_DASHED.

void setBorderDashWidthAmbient(int borderDashWidth)

Sets the dash width used in ambient mode when drawing borders with style BORDER_STYLE_DASHED.

void setBorderRadiusActive(int borderRadius)

Sets the border radius to be applied to the corners of the bounds of the complication in active mode.

void setBorderRadiusAmbient(int borderRadius)

Sets the border radius to be applied to the corners of the bounds of the complication in ambient mode.

void setBorderStyleActive(int borderStyle)

Sets the border style used in active mode.

void setBorderStyleAmbient(int borderStyle)

Sets the border style used in ambient mode.

void setBorderWidthActive(int borderWidth)

Sets the border width for active mode.

void setBorderWidthAmbient(int borderWidth)

Sets the border width for ambient mode.

void setBurnInProtection(boolean burnInProtection)

Sets whether the complication, when rendering in ambient mode, should apply a style suitable for display on devices with burn in protection.

void setColorFilter(ColorFilter colorFilter)

Does nothing.

void setComplicationData(ComplicationData complicationData)

Sets the complication data to be drawn.

void setContext(Context context)

Sets the context used to render the complication.

void setCurrentTimeMillis(long currentTimeMillis)

Sets the current time.

void setHighlightColorActive(int highlightColor)

Sets the highlight color used in active mode, which is applied when setIsHighlighted(boolean) is called.

void setHighlightColorAmbient(int highlightColor)

Sets the highlight color used in ambient mode, which is applied when setIsHighlighted(boolean) is called.

void setIconColorActive(int iconColor)

Sets the icon color used for tinting icons in active mode.

void setIconColorAmbient(int iconColor)

Sets the icon color used for tinting icons in ambient mode.

void setImageColorFilterActive(ColorFilter colorFilter)

Sets the color filter used in active mode when rendering large images and small images with style IMAGE_STYLE_PHOTO.

void setImageColorFilterAmbient(ColorFilter colorFilter)

Sets the color filter used in ambient mode when rendering large images and small images with style IMAGE_STYLE_PHOTO.

void setInAmbientMode(boolean inAmbientMode)

Sets whether the complication should be rendered in ambient mode.

void setIsHighlighted(boolean isHighlighted)

Sets whether the complication is currently highlighted.

void setLowBitAmbient(boolean lowBitAmbient)

Sets whether the complication, when rendering in ambient mode, should apply a style suitable low bit ambient mode.

void setNoDataText(CharSequence noDataText)

Sets the text to be rendered when ComplicationData is of type TYPE_NO_DATA.

void setRangedValuePrimaryColorActive(int rangedValuePrimaryColor)

Sets the main color for the ranged value indicator in active mode.

void setRangedValuePrimaryColorAmbient(int rangedValuePrimaryColor)

Sets the main color for the ranged value indicator in ambient mode.

void setRangedValueRingWidthActive(int rangedValueRingWidth)

Sets the stroke width used in active mode when rendering the ranged value indicator.

void setRangedValueRingWidthAmbient(int rangedValueRingWidth)

Sets the stroke width used in ambient mode when rendering the ranged value indicator.

void setRangedValueSecondaryColorActive(int rangedValueSecondaryColor)

Sets the secondary color for the ranged value indicator in active mode.

void setRangedValueSecondaryColorAmbient(int rangedValueSecondaryColor)

Sets the secondary color for the ranged value indicator in ambient mode.

void setTextColorActive(int textColor)

Sets the text color used in active mode.

void setTextColorAmbient(int textColor)

Sets the text color used in ambient mode.

void setTextSizeActive(int textSize)

Sets the text size used in active mode when rendering short text and long text fields.

void setTextSizeAmbient(int textSize)

Sets the text size used in ambient mode when rendering short text and long text fields.

void setTextTypefaceActive(Typeface textTypeface)

Sets the typeface used in active mode when rendering short text and long text fields.

void setTextTypefaceAmbient(Typeface textTypeface)

Sets the typeface used in ambient mode when rendering short text and long text fields.

void setTitleColorActive(int titleColor)

Sets the title color used in active mode.

void setTitleColorAmbient(int titleColor)

Sets the title color used in ambient mode.

void setTitleSizeActive(int titleSize)

Sets the text size used in active mode when rendering short title and long title fields.

void setTitleSizeAmbient(int titleSize)

Sets the text size used in ambient mode when rendering short title and long title fields.

void setTitleTypefaceActive(Typeface titleTypeface)

Sets the typeface used in active mode when rendering short text and long text fields.

void setTitleTypefaceAmbient(Typeface titleTypeface)

Sets the typeface used in ambient mode when rendering short text and long text fields.

Protected methods

void onBoundsChange(Rect bounds)

Inherited methods

From class android.graphics.drawable.Drawable
From class java.lang.Object

XML attributes

android.support.wearable:backgroundColor

Related methods:

android.support.wearable:backgroundDrawable

Related methods:

android.support.wearable:borderColor

Related methods:

android.support.wearable:borderDashGap

Related methods:

android.support.wearable:borderDashWidth

Related methods:

android.support.wearable:borderRadius

Related methods:

android.support.wearable:borderStyle

Related methods:

android.support.wearable:borderWidth

Related methods:

android.support.wearable:highlightColor

Related methods:

android.support.wearable:iconColor

Related methods:

android.support.wearable:rangedValuePrimaryColor

Related methods:

android.support.wearable:rangedValueRingWidth

Related methods:

android.support.wearable:rangedValueSecondaryColor

Related methods:

android.support.wearable:textColor

Related methods:

android.support.wearable:textSize

Related methods:

android.support.wearable:textTypeface

Related methods:

android.support.wearable:titleColor

Related methods:

android.support.wearable:titleSize

Related methods:

android.support.wearable:titleTypeface

Related methods:

Constants

BORDER_STYLE_DASHED

int BORDER_STYLE_DASHED

Style where the borders are drawn as dashed lines. If this is set as current border style, dash width and dash gap should also be set via setBorderDashWidthActive(int), setBorderDashGapActive(int), setBorderDashWidthAmbient(int), setBorderDashGapAmbient(int) or XML attributes, or default values will be used.

Constant Value: 2 (0x00000002)

BORDER_STYLE_NONE

int BORDER_STYLE_NONE

Style where the borders are not drawn.

Constant Value: 0 (0x00000000)

BORDER_STYLE_SOLID

int BORDER_STYLE_SOLID

Style where the borders are drawn without any gap.

Constant Value: 1 (0x00000001)

Public constructors

ComplicationDrawable

ComplicationDrawable ()

Default constructor.

ComplicationDrawable

ComplicationDrawable (Context context)

Creates a ComplicationDrawable using the given context. If this constructor is used, calling setContext(Context) may not be necessary.

Parameters
context Context

Public methods

draw

void draw (Canvas canvas)

Draws the complication for the last known time. Last known time is derived from either draw(Canvas, long) or setCurrentTimeMillis(long) depending on which was called most recently.

Parameters
canvas Canvas: Canvas for the complication to be drawn onto

draw

void draw (Canvas canvas, 
                long currentTimeMillis)

Draws the complication into bounds set via setBounds(Rect) for the given time. Calling this method is equivalent to calling setCurrentTimeMillis(long) followed by draw(Canvas), so it will update the last known time and any future calls to draw(Canvas) will use the time passed to this method.

Parameters
canvas Canvas: Canvas for the complication to be drawn onto
currentTimeMillis long: The time complication is drawn at in milliseconds

getOpacity

int getOpacity ()

Returns
int

inflate

void inflate (Resources r, 
                XmlPullParser parser, 
                AttributeSet attrs, 
                Resources.Theme theme)

Inflates this ComplicationDrawable from an XML resource. This can't be called more than once for each ComplicationDrawable. Note that framework may have called this once to create the ComplicationDrawable instance from an XML resource.

Parameters
r Resources: Resources used to resolve attribute values
parser XmlPullParser: XML parser from which to inflate this ComplicationDrawable
attrs AttributeSet: Base set of attribute values
theme Resources.Theme: Ignored by ComplicationDrawable
Throws
XmlPullParserException
IOException

setAlpha

void setAlpha (int alpha)

Does nothing.

Parameters
alpha int

setBackgroundColorActive

void setBackgroundColorActive (int backgroundColor)

Sets the background color used in active mode.

Related XML Attributes:

Parameters
backgroundColor int

setBackgroundColorAmbient

void setBackgroundColorAmbient (int backgroundColor)

Sets the background color used in ambient mode.

Related XML Attributes:

Parameters
backgroundColor int

setBackgroundDrawableActive

void setBackgroundDrawableActive (Drawable drawable)

Sets the background drawable used in active mode.

Related XML Attributes:

Parameters
drawable Drawable

setBackgroundDrawableAmbient

void setBackgroundDrawableAmbient (Drawable drawable)

Sets the background drawable used in ambient mode.

Related XML Attributes:

Parameters
drawable Drawable

setBorderColorActive

void setBorderColorActive (int borderColor)

Sets the border color used in active mode.

Related XML Attributes:

Parameters
borderColor int

setBorderColorAmbient

void setBorderColorAmbient (int borderColor)

Sets the border color used in ambient mode.

Related XML Attributes:

Parameters
borderColor int

setBorderDashGapActive

void setBorderDashGapActive (int borderDashGap)

Sets the dash gap used in active mode when drawing borders with style BORDER_STYLE_DASHED.

Related XML Attributes:

Parameters
borderDashGap int: Dash gap in pixels

setBorderDashGapAmbient

void setBorderDashGapAmbient (int borderDashGap)

Sets the dash gap used in ambient mode when drawing borders with style BORDER_STYLE_DASHED.

Related XML Attributes:

Parameters
borderDashGap int: Dash gap in pixels

setBorderDashWidthActive

void setBorderDashWidthActive (int borderDashWidth)

Sets the dash width used in active mode when drawing borders with style BORDER_STYLE_DASHED.

Related XML Attributes:

Parameters
borderDashWidth int: Dash width in pixels

setBorderDashWidthAmbient

void setBorderDashWidthAmbient (int borderDashWidth)

Sets the dash width used in ambient mode when drawing borders with style BORDER_STYLE_DASHED.

Related XML Attributes:

Parameters
borderDashWidth int: Dash width in pixels

setBorderRadiusActive

void setBorderRadiusActive (int borderRadius)

Sets the border radius to be applied to the corners of the bounds of the complication in active mode. Border radius will be limited to the half of width or height, depending on which one is smaller.

Related XML Attributes:

Parameters
borderRadius int: Border radius in pixels

setBorderRadiusAmbient

void setBorderRadiusAmbient (int borderRadius)

Sets the border radius to be applied to the corners of the bounds of the complication in ambient mode. Border radius will be limited to the half of width or height, depending on which one is smaller.

Related XML Attributes:

Parameters
borderRadius int: Border radius in pixels

setBorderStyleActive

void setBorderStyleActive (int borderStyle)

Sets the border style used in active mode. It should be one of BORDER_STYLE_NONE, BORDER_STYLE_SOLID, or BORDER_STYLE_DASHED.

Related XML Attributes:

Parameters
borderStyle int

See also:

setBorderStyleAmbient

void setBorderStyleAmbient (int borderStyle)

Sets the border style used in ambient mode. It should be one of BORDER_STYLE_NONE, BORDER_STYLE_SOLID, or BORDER_STYLE_DASHED.

Related XML Attributes:

Parameters
borderStyle int

See also:

setBorderWidthActive

void setBorderWidthActive (int borderWidth)

Sets the border width for active mode.

Related XML Attributes:

Parameters
borderWidth int: Border width in pixels

setBorderWidthAmbient

void setBorderWidthAmbient (int borderWidth)

Sets the border width for ambient mode.

Related XML Attributes:

Parameters
borderWidth int: Border width in pixels

setBurnInProtection

void setBurnInProtection (boolean burnInProtection)

Sets whether the complication, when rendering in ambient mode, should apply a style suitable for display on devices with burn in protection. This should be set when onPropertiesChanged(android.os.Bundle) is called.

Parameters
burnInProtection boolean

setColorFilter

void setColorFilter (ColorFilter colorFilter)

Does nothing. Use setImageColorFilterActive(ColorFilter) or setImageColorFilterAmbient(ColorFilter) instead to apply color filter to small and large images.

Parameters
colorFilter ColorFilter

setComplicationData

void setComplicationData (ComplicationData complicationData)

Sets the complication data to be drawn. If complicationData is null, nothing will be drawn when draw(Canvas) or draw(Canvas, long) is called.

Parameters
complicationData ComplicationData

setContext

void setContext (Context context)

Sets the context used to render the complication. If a context is not set, ComplicationDrawable will throw an IllegalStateException if one of draw(Canvas), draw(Canvas, long), setBounds(Rect), or setComplicationData(ComplicationData) is called.

If this ComplicationDrawable is retrieved using getDrawable(int, Theme), this method must be called before calling any of the methods mentioned above.

If this ComplicationDrawable is not inflated from an XML file, this method will reset the style to match the default values, so if ComplicationDrawable() is used to construct a ComplicationDrawable, this method should be called right after.

Parameters
context Context

setCurrentTimeMillis

void setCurrentTimeMillis (long currentTimeMillis)

Sets the current time. This will be used to render ComplicationData with time dependent text.

Parameters
currentTimeMillis long: time in milliseconds

setHighlightColorActive

void setHighlightColorActive (int highlightColor)

Sets the highlight color used in active mode, which is applied when setIsHighlighted(boolean) is called.

Related XML Attributes:

Parameters
highlightColor int: Highlight color

setHighlightColorAmbient

void setHighlightColorAmbient (int highlightColor)

Sets the highlight color used in ambient mode, which is applied when setIsHighlighted(boolean) is called.

Related XML Attributes:

Parameters
highlightColor int: Highlight color

setIconColorActive

void setIconColorActive (int iconColor)

Sets the icon color used for tinting icons in active mode.

Related XML Attributes:

Parameters
iconColor int

setIconColorAmbient

void setIconColorAmbient (int iconColor)

Sets the icon color used for tinting icons in ambient mode.

Related XML Attributes:

Parameters
iconColor int

setImageColorFilterActive

void setImageColorFilterActive (ColorFilter colorFilter)

Sets the color filter used in active mode when rendering large images and small images with style IMAGE_STYLE_PHOTO.

Parameters
colorFilter ColorFilter

setImageColorFilterAmbient

void setImageColorFilterAmbient (ColorFilter colorFilter)

Sets the color filter used in ambient mode when rendering large images and small images with style IMAGE_STYLE_PHOTO.

Parameters
colorFilter ColorFilter

setInAmbientMode

void setInAmbientMode (boolean inAmbientMode)

Sets whether the complication should be rendered in ambient mode. Ideally, this should be set when onAmbientModeChanged(boolean) is called.

Parameters
inAmbientMode boolean

setIsHighlighted

void setIsHighlighted (boolean isHighlighted)

Sets whether the complication is currently highlighted. This may be called by a watch face when a complication is tapped.

setLowBitAmbient

void setLowBitAmbient (boolean lowBitAmbient)

Sets whether the complication, when rendering in ambient mode, should apply a style suitable low bit ambient mode. This should be set when onPropertiesChanged(android.os.Bundle) is called.

Parameters
lowBitAmbient boolean

setNoDataText

void setNoDataText (CharSequence noDataText)

Sets the text to be rendered when ComplicationData is of type TYPE_NO_DATA. If no data text is null, an empty text will be rendered.

Parameters
noDataText CharSequence

setRangedValuePrimaryColorActive

void setRangedValuePrimaryColorActive (int rangedValuePrimaryColor)

Sets the main color for the ranged value indicator in active mode.

Related XML Attributes:

Parameters
rangedValuePrimaryColor int

setRangedValuePrimaryColorAmbient

void setRangedValuePrimaryColorAmbient (int rangedValuePrimaryColor)

Sets the main color for the ranged value indicator in ambient mode.

Related XML Attributes:

Parameters
rangedValuePrimaryColor int

setRangedValueRingWidthActive

void setRangedValueRingWidthActive (int rangedValueRingWidth)

Sets the stroke width used in active mode when rendering the ranged value indicator.

Related XML Attributes:

Parameters
rangedValueRingWidth int: Ring width in pixels

setRangedValueRingWidthAmbient

void setRangedValueRingWidthAmbient (int rangedValueRingWidth)

Sets the stroke width used in ambient mode when rendering the ranged value indicator.

Related XML Attributes:

Parameters
rangedValueRingWidth int: Ring width in pixels

setRangedValueSecondaryColorActive

void setRangedValueSecondaryColorActive (int rangedValueSecondaryColor)

Sets the secondary color for the ranged value indicator in active mode.

Related XML Attributes:

Parameters
rangedValueSecondaryColor int

setRangedValueSecondaryColorAmbient

void setRangedValueSecondaryColorAmbient (int rangedValueSecondaryColor)

Sets the secondary color for the ranged value indicator in ambient mode.

Related XML Attributes:

Parameters
rangedValueSecondaryColor int

setTextColorActive

void setTextColorActive (int textColor)

Sets the text color used in active mode. Text color is used for rendering short text and long text fields.

Related XML Attributes:

Parameters
textColor int

setTextColorAmbient

void setTextColorAmbient (int textColor)

Sets the text color used in ambient mode. Text color is used for rendering short text and long text fields.

Related XML Attributes:

Parameters
textColor int

setTextSizeActive

void setTextSizeActive (int textSize)

Sets the text size used in active mode when rendering short text and long text fields.

Related XML Attributes:

Parameters
textSize int

setTextSizeAmbient

void setTextSizeAmbient (int textSize)

Sets the text size used in ambient mode when rendering short text and long text fields.

Related XML Attributes:

Parameters
textSize int

setTextTypefaceActive

void setTextTypefaceActive (Typeface textTypeface)

Sets the typeface used in active mode when rendering short text and long text fields.

Related XML Attributes:

Parameters
textTypeface Typeface

setTextTypefaceAmbient

void setTextTypefaceAmbient (Typeface textTypeface)

Sets the typeface used in ambient mode when rendering short text and long text fields.

Related XML Attributes:

Parameters
textTypeface Typeface

setTitleColorActive

void setTitleColorActive (int titleColor)

Sets the title color used in active mode. Title color is used for rendering short title and long title fields.

Related XML Attributes:

Parameters
titleColor int

setTitleColorAmbient

void setTitleColorAmbient (int titleColor)

Sets the title color used in ambient mode. Title color is used for rendering short title and long title fields.

Related XML Attributes:

Parameters
titleColor int

setTitleSizeActive

void setTitleSizeActive (int titleSize)

Sets the text size used in active mode when rendering short title and long title fields.

Related XML Attributes:

Parameters
titleSize int

setTitleSizeAmbient

void setTitleSizeAmbient (int titleSize)

Sets the text size used in ambient mode when rendering short title and long title fields.

Related XML Attributes:

Parameters
titleSize int

setTitleTypefaceActive

void setTitleTypefaceActive (Typeface titleTypeface)

Sets the typeface used in active mode when rendering short text and long text fields.

Related XML Attributes:

Parameters
titleTypeface Typeface

setTitleTypefaceAmbient

void setTitleTypefaceAmbient (Typeface titleTypeface)

Sets the typeface used in ambient mode when rendering short text and long text fields.

Related XML Attributes:

Parameters
titleTypeface Typeface

Protected methods

onBoundsChange

void onBoundsChange (Rect bounds)

Parameters
bounds Rect
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.