Google is committed to advancing racial equity for Black communities. See how.

WearCurvedTextView

open class WearCurvedTextView : View, WearArcLayout.ArcLayoutWidget
kotlin.Any
   ↳ android.view.View
   ↳ androidx.wear.widget.WearCurvedTextView

A WearCurvedTextView is a component allowing developers to easily write curved text following the curvature of the largest circle that can be inscribed in the view. WearArcLayout could be used to concatenate multiple curved texts, also layout together with other widgets such as icons.

Summary

Public constructors
<init>(@NonNull context: Context)

<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?)

<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?, defStyle: Int)

<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?, defStyle: Int, defStyleRes: Int)

Public methods
open Unit

open Unit
draw(@NonNull canvas: Canvas)

open Float

Returns the anchor angle used for positioning the text, in degrees.

open Int

returns the anchor type for positioning the curved text

open Boolean

returns the curved text layout direction

open TruncateAt?

Returns where, if anywhere, words that are longer than the view is wide should be ellipsized.

open String?

Returns the font feature settings.

open String?

Returns TrueType or OpenType font variation settings.

open Float

Gets the text letter-space value, which determines the spacing between characters.

open Float

open Float

returns the sweep angle in degrees for rendering the text

open String

returns the text to be rendered

open Int

returns the color for rendering the text

open Float

returns the text size for rendering the text

open Int

open Typeface?

Gets the current Typeface that is used to style the text.

open Boolean

open Unit

Sets the anchor angle used for positioning the text, in degrees.

open Unit

Sets the anchor type for positioning the curved text.

open Unit

sets the curved text layout direction

open Unit
setEllipsize(@Nullable value: TruncateAt?)

Causes words in the text that are longer than the view's width to be ellipsized.

open Unit
setFontFeatureSettings(@Nullable value: String?)

Sets font feature settings.

open Unit
setFontVariationSettings(@Nullable value: String?)

Sets TrueType or OpenType font variation settings.

open Unit

Sets text letter-spacing in ems.

open Unit

sets the sweep angle in degrees for rendering the text

open Unit
setText(@NonNull value: String)

sets the text to be rendered

open Unit
setTextColor(@ColorInt value: Int)

sets the color for rendering the text

open Unit

sets the text size for rendering the text

open Unit
setTypeface(@Nullable value: Typeface?)

Sets the typeface and style in which the text should be displayed.

Protected methods
open Unit
onDraw(@NonNull canvas: Canvas)

open Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)

Public constructors

<init>

WearCurvedTextView(@NonNull context: Context)

<init>

WearCurvedTextView(
    @NonNull context: Context,
    @Nullable attrs: AttributeSet?)

<init>

WearCurvedTextView(
    @NonNull context: Context,
    @Nullable attrs: AttributeSet?,
    defStyle: Int)

<init>

WearCurvedTextView(
    @NonNull context: Context,
    @Nullable attrs: AttributeSet?,
    defStyle: Int,
    defStyleRes: Int)

Public methods

checkInvalidAttributeAsChild

open fun checkInvalidAttributeAsChild(parentClockwise: Boolean): Unit
Parameters
clockwise the layout direction of the container
Exceptions
IllegalArgumentException if the anchorType and/or anchorAngleDegrees attributes were set for a widget in WearArcLayout

draw

open fun draw(@NonNull canvas: Canvas): Unit

getAnchorAngleDegrees

open fun getAnchorAngleDegrees(): Float

Returns the anchor angle used for positioning the text, in degrees.

getAnchorType

open fun getAnchorType(): Int

returns the anchor type for positioning the curved text

getClockwise

open fun getClockwise(): Boolean

returns the curved text layout direction

getEllipsize

@Nullable open fun getEllipsize(): TruncateAt?

Returns where, if anywhere, words that are longer than the view is wide should be ellipsized.

getFontFeatureSettings

@Nullable open fun getFontFeatureSettings(): String?

Returns the font feature settings. The format is the same as the CSS font-feature-settings attribute: https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop

Return
String? the currently set font feature settings. Default is null.

getFontVariationSettings

@Nullable open fun getFontVariationSettings(): String?

Returns TrueType or OpenType font variation settings.

getLetterSpacing

open fun getLetterSpacing(): Float

Gets the text letter-space value, which determines the spacing between characters. The value returned is in ems. Normally, this value is 0.0.

Return
Float The text letter-space value in ems.

getSweepAngleDegrees

open fun getSweepAngleDegrees(): Float

getSweepDegrees

open fun getSweepDegrees(): Float

returns the sweep angle in degrees for rendering the text

getText

@NonNull open fun getText(): String

returns the text to be rendered

getTextColor

@ColorInt open fun getTextColor(): Int

returns the color for rendering the text

getTextSize

open fun getTextSize(): Float

returns the text size for rendering the text

getThicknessPx

open fun getThicknessPx(): Int

getTypeface

@Nullable open fun getTypeface(): Typeface?

Gets the current Typeface that is used to style the text.

handleLayoutRotate

open fun handleLayoutRotate(angle: Float): Boolean

setAnchorAngleDegrees

open fun setAnchorAngleDegrees(value: Float): Unit

Sets the anchor angle used for positioning the text, in degrees.

setAnchorType

open fun setAnchorType(value: Int): Unit

Sets the anchor type for positioning the curved text.

Parameters
value Int: the anchor type, one of {ANCHOR_START, ANCHOR_CENTER, ANCHOR_END}

setClockwise

open fun setClockwise(value: Boolean): Unit

sets the curved text layout direction

setEllipsize

open fun setEllipsize(@Nullable value: TruncateAt?): Unit

Causes words in the text that are longer than the view's width to be ellipsized. Use null to turn off ellipsizing.

setFontFeatureSettings

open fun setFontFeatureSettings(@Nullable value: String?): Unit

Sets font feature settings. The format is the same as the CSS font-feature-settings attribute: https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop

Parameters
value String?: font feature settings represented as CSS compatible string. This value may be null.

setFontVariationSettings

open fun setFontVariationSettings(@Nullable value: String?): Unit

Sets TrueType or OpenType font variation settings.

Parameters
value String?: font variation settings. You can pass null or empty string as no variation settings. This value may be null

setLetterSpacing

open fun setLetterSpacing(value: Float): Unit

Sets text letter-spacing in ems. Typical values for slight expansion will be around 0.05. Negative values tighten text.

Parameters
value Float: A text letter-space value in ems.

setSweepDegrees

open fun setSweepDegrees(value: Float): Unit

sets the sweep angle in degrees for rendering the text

setText

open fun setText(@NonNull value: String): Unit

sets the text to be rendered

setTextColor

open fun setTextColor(@ColorInt value: Int): Unit

sets the color for rendering the text

setTextSize

open fun setTextSize(value: Float): Unit

sets the text size for rendering the text

setTypeface

open fun setTypeface(@Nullable value: Typeface?): Unit

Sets the typeface and style in which the text should be displayed. Note that not all Typeface families actually have bold and italic variants

Protected methods

onDraw

protected open fun onDraw(@NonNull canvas: Canvas): Unit

onSizeChanged

protected open fun onSizeChanged(
    w: Int,
    h: Int,
    oldw: Int,
    oldh: Int
): Unit