CurvedTextView

Added in 1.2.0

public class CurvedTextView extends View implements ArcLayout.Widget


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

Summary

Public constructors

CurvedTextView(
    @NonNull Context context,
    @Nullable AttributeSet attrs,
    int defStyle
)
CurvedTextView(
    @NonNull Context context,
    @Nullable AttributeSet attrs,
    int defStyle,
    int defStyleRes
)

Public methods

void
void
draw(@NonNull Canvas canvas)
@FloatRange(from = 0.0, to = 360.0, toInclusive = true) float

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

int

Returns the anchor type for positioning the curved text

@Nullable TextUtils.TruncateAt

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

@Nullable String

Returns the font feature settings.

@Nullable String

Returns TrueType or OpenType font variation settings.

float

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

@FloatRange(from = 0.0, to = 360.0, toInclusive = true) float

Returns the maximum sweep angle in degrees for rendering the text

@FloatRange(from = 0.0, to = 360.0, toInclusive = true) float

Returns the sweep angle in degrees for rendering the text

@FloatRange(from = 0.0, to = 360.0, toInclusive = true) float

Returns the sweep angle that this widget is drawn with.

@Nullable String

Returns the text to be rendered

@ColorInt int

Returns the color for rendering the text

float

Returns the text size for rendering the text

@Px int

Returns the thickness of this widget inside the arc.

@Nullable Typeface

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

boolean

Returns the curved text layout direction

boolean
isPointInsideClickArea(float x, float y)

See isPointInsideClickArea

void
void
boolean
void
setAnchorAngleDegrees(
    @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float value
)

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

void
setAnchorType(int value)

Sets the anchor type for positioning the curved text.

void
setClockwise(boolean value)

Sets the curved text layout direction

void

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

void

Sets font feature settings.

void

Sets TrueType or OpenType font variation settings.

void
setLetterSpacing(float value)

Sets text letter-spacing in ems.

void
setSweepAngleDegrees(
    @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float angleDegrees
)

Set the sweep angle that this widget is drawn with.

void
setSweepRangeDegrees(
    @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float minSweep,
    @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float maxSweep
)

Sets the minimum and maximum sweep angle in degrees for rendering the text.

void

Sets the text to be rendered

void
setTextColor(@ColorInt int value)

Sets the color for rendering the text

void
setTextSize(float value)

Sets the text size for rendering the text

void

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

void
setTypeface(@Nullable Typeface tf, int style)

Sets the typeface and style in which the text should be displayed, and turns on the fake bold and italic bits in the Paint if the Typeface that you provided does not have all the bits in the style that you specified.

Protected methods

void
void
onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void
onSizeChanged(int w, int h, int oldw, int oldh)

Inherited Constants

From android.view.View
static final int
static final int
static final int
static final int
static final int
static final int
static final Property<ViewFloat>
static final int
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE = "creditCardExpirationDate"
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY = "creditCardExpirationDay"
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH = "creditCardExpirationMonth"
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR = "creditCardExpirationYear"
static final String
static final String
AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE = "creditCardSecurityCode"
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int
static final int
static final int
static final int
static final int
static final int
static final int[]
static final int[]
static final int[]
static final int[]
static final int
static final int
static final int
static final int
static final int
static final int
static final int
GONE = 8
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
KEEP_SCREEN_ON = 67108864
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
NO_ID = -1
static final int
static final int
static final int
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int[]
static final int[]
static final int
static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final String
VIEW_LOG_TAG = "View"
static final int
static final int[]
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>

Inherited methods

From android.view.View
void
void
addExtraDataToAccessibilityNodeInfo(
    AccessibilityNodeInfo info,
    String extraDataKey,
    Bundle arguments
)
void
addFocusables(ArrayList<View> views, int direction)
void
void
void
void
void
ViewPropertyAnimator
void
void
boolean
void
void

This method is deprecated.

void
boolean
boolean
boolean
boolean
boolean
canScrollHorizontally(int direction)
boolean
canScrollVertically(int direction)
final void
void
final void
boolean
void
void
void
static int
combineMeasuredStates(int curState, int newState)
int
int
int
void
WindowInsets
int
int
int
AccessibilityNodeInfo
void
void

This method is deprecated.

WindowInsets
boolean
void
void
dispatchCreateViewTranslationRequest(
    Map<AutofillId, long[]> viewIds,
    int[] supportedFormats,
    TranslationCapability capability,
    List<ViewTranslationRequest> requests
)
void
boolean
void
void
dispatchDrawableHotspotChanged(float x, float y)
void
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
dispatchNestedFling(float velocityX, float velocityY, boolean consumed)
boolean
dispatchNestedPreFling(float velocityX, float velocityY)
boolean
dispatchNestedPrePerformAccessibilityAction(
    int action,
    Bundle arguments
)
boolean
dispatchNestedPreScroll(
    int dx,
    int dy,
    int[] consumed,
    int[] offsetInWindow
)
boolean
dispatchNestedScroll(
    int dxConsumed,
    int dyConsumed,
    int dxUnconsumed,
    int dyUnconsumed,
    int[] offsetInWindow
)
void
dispatchPointerCaptureChanged(boolean hasCapture)
boolean
void
void
void
void
void
dispatchScrollCaptureSearch(
    Rect localVisibleRect,
    Point windowOffset,
    Consumer<ScrollCaptureTarget> targets
)
void
dispatchSetActivated(boolean activated)
void
dispatchSetPressed(boolean pressed)
void
dispatchSetSelected(boolean selected)
void
void

This method is deprecated.

boolean
boolean
boolean
dispatchUnhandledMove(View focused, int direction)
void
dispatchVisibilityChanged(View changedView, int visibility)
void
dispatchWindowFocusChanged(boolean hasFocus)
void
void
WindowInsets
WindowInsetsAnimation.Bounds
void

This method is deprecated.

void
void
drawableHotspotChanged(float x, float y)
void
View
final OnBackInvokedDispatcher
final T
<T extends View> findViewById(int id)
final T
<T extends View> findViewWithTag(Object tag)
void
findViewsWithText(
    ArrayList<View> outViews,
    CharSequence searched,
    int flags
)
boolean

This method is deprecated.

View
focusSearch(int direction)
void
forceHasOverlappingRendering(boolean hasOverlappingRendering)
void
boolean
void
generateDisplayHash(
    String hashAlgorithm,
    Rect bounds,
    Executor executor,
    DisplayHashResultCallback callback
)
static int
CharSequence
View.AccessibilityDelegate
int
AccessibilityNodeProvider
CharSequence
int
int
String
String
float
Animation
Matrix
IBinder
int[]
Map<IntegerInteger>
String[]
final AutofillId
int
AutofillValue
Drawable
BlendMode
ColorStateList
PorterDuff.Mode
int
final int
float
int
float
Rect
boolean
final boolean
final ContentCaptureSession
CharSequence
final Context
ContextMenu.ContextMenuInfo
final boolean
static int
getDefaultSize(int size, int measureSpec)
Display
final int[]
Bitmap

This method is deprecated.

int

This method is deprecated.

int

This method is deprecated.

void
long
float
int
boolean
boolean
int
ArrayList<View>
getFocusables(int direction)
void
Drawable
int
BlendMode
ColorStateList
PorterDuff.Mode
boolean
getGlobalVisibleRect(Rect r, Point globalOffset)
Handler
float
float
float
float
Runnable
final boolean
final int
void
getHitRect(Rect outRect)
int
int
Drawable
Drawable
int
int
int
int
boolean
KeyEvent.DispatcherState
int
int
int
ViewGroup.LayoutParams
final int
float
int
final boolean
void
getLocationInSurface(int[] location)
void
getLocationInWindow(int[] outLocation)
void
getLocationOnScreen(int[] outLocation)
Matrix
final int
final int
final int
final int
final int
int
int
int
int
int
int
int
int
View.OnFocusChangeListener
int
ViewOutlineProvider
int
int
ViewOverlay
int
int
int
int
int
int
final ViewParent
ViewParent
float
float
PointerIcon
final List<Rect>
String[]
Resources
final boolean
final int
float
int
AttachedSurfaceControl
View
WindowInsets
float
float
float
float
float
int
int
int
int
int
int
final int
final int
int
int
final CharSequence
StateListAnimator
int
int
List<Rect>
int

This method is deprecated.

Object
int
int
CharSequence
final int
float
int
TouchDelegate
ArrayList<View>
float
String
float
float
float
long
int
int
Drawable
Drawable
int
ViewTranslationResponse
ViewTreeObserver
int
final int
int
WindowId
WindowInsetsController
int

This method is deprecated.

IBinder
int
void
float
float
float
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
static View
inflate(Context context, int resource, ViewGroup root)
void

This method is deprecated.

void
void
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean

This method is deprecated.

boolean
boolean
final boolean
final boolean
boolean
final boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
final boolean
final boolean
boolean
boolean
boolean
final boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
final boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
final boolean
boolean
boolean
final boolean
boolean
boolean
boolean
boolean
boolean
void
View
keyboardNavigationClusterSearch(View currentCluster, int direction)
void
layout(int l, int t, int r, int b)
final void
measure(int widthMeasureSpec, int heightMeasureSpec)
static int[]
mergeDrawableStates(int[] baseState, int[] additionalState)
void
offsetLeftAndRight(int offset)
void
offsetTopAndBottom(int offset)
void
void
WindowInsets
void
void
boolean
boolean
void
void
int[]
onCreateDrawableState(int extraSpace)
InputConnection
void
onCreateViewTranslationRequest(
    int[] supportedFormats,
    Consumer<ViewTranslationRequest> requestsCollector
)
void
onCreateVirtualViewTranslationRequests(
    long[] virtualIds,
    int[] supportedFormats,
    Consumer<ViewTranslationRequest> requestsCollector
)
void
void
onDisplayHint(int hint)
boolean
void
final void
boolean
void
void
void
onFocusChanged(
    boolean gainFocus,
    int direction,
    Rect previouslyFocusedRect
)
boolean
void
onHoverChanged(boolean hovered)
boolean
void
boolean
onKeyDown(int keyCode, KeyEvent event)
boolean
onKeyLongPress(int keyCode, KeyEvent event)
boolean
onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
boolean
onKeyPreIme(int keyCode, KeyEvent event)
boolean
onKeyShortcut(int keyCode, KeyEvent event)
boolean
onKeyUp(int keyCode, KeyEvent event)
void
onLayout(boolean changed, int left, int top, int right, int bottom)
void
onOverScrolled(
    int scrollX,
    int scrollY,
    boolean clampedX,
    boolean clampedY
)
void
onPointerCaptureChange(boolean hasCapture)
void
onProvideAutofillStructure(ViewStructure structure, int flags)
void
void
void
void
ContentInfo
PointerIcon
onResolvePointerIcon(MotionEvent event, int pointerIndex)
void
void
onRtlPropertiesChanged(int layoutDirection)
Parcelable
void
onScreenStateChanged(int screenState)
void
onScrollCaptureSearch(
    Rect localVisibleRect,
    Point windowOffset,
    Consumer<ScrollCaptureTarget> targets
)
void
onScrollChanged(int l, int t, int oldl, int oldt)
boolean
onSetAlpha(int alpha)
void
boolean
void
void
void
onVisibilityAggregated(boolean isVisible)
void
onVisibilityChanged(View changedView, int visibility)
void
onWindowFocusChanged(boolean hasWindowFocus)
void

This method is deprecated.

void
onWindowVisibilityChanged(int visibility)
boolean
overScrollBy(
    int deltaX,
    int deltaY,
    int scrollX,
    int scrollY,
    int scrollRangeX,
    int scrollRangeY,
    int maxOverScrollX,
    int maxOverScrollY,
    boolean isTouchEvent
)
boolean
performAccessibilityAction(int action, Bundle arguments)
boolean
boolean
performContextClick(float x, float y)
boolean
performHapticFeedback(int feedbackConstant)
boolean
ContentInfo
void
playSoundEffect(int soundConstant)
boolean
post(Runnable action)
boolean
postDelayed(Runnable action, long delayMillis)
void
void
postInvalidateDelayed(long delayMilliseconds)
void
void
void
postOnAnimationDelayed(Runnable action, long delayMillis)
void
void
boolean
void
void
void
void
void

This method is deprecated.

final boolean
final boolean
void
void
boolean
final void
final T
<T extends View> requireViewById(int id)
void
static int
resolveSize(int size, int measureSpec)
static int
resolveSizeAndState(int size, int measureSpec, int childMeasuredState)
boolean
void
final void
saveAttributeDataForStyleable(
    Context context,
    int[] styleable,
    AttributeSet attrs,
    TypedArray t,
    int defStyleAttr,
    int defStyleRes
)
void
void
scheduleDrawable(Drawable who, Runnable what, long when)
void
scrollBy(int x, int y)
void
scrollTo(int x, int y)
void
sendAccessibilityEvent(int eventType)
void
void
setAccessibilityDataSensitive(int accessibilityDataSensitive)
void
void
setAccessibilityHeading(boolean isHeading)
void
void
setAccessibilityPaneTitle(CharSequence accessibilityPaneTitle)
void
void
void
setActivated(boolean activated)
void
setAllowClickWhenDisabled(boolean clickableWhenDisabled)
void
void
void
setAlpha(float alpha)
void
void
void
setAutoHandwritingEnabled(boolean enabled)
void
setAutofillHints(String[] autofillHints)
void
void
setBackground(Drawable background)
void
setBackgroundColor(int color)
void

This method is deprecated.

void
void
void
void
final void
setBottom(int bottom)
void
setCameraDistance(float distance)
void
setClickable(boolean clickable)
void
setClipBounds(Rect clipBounds)
void
setClipToOutline(boolean clipToOutline)
void
void
setContentDescription(CharSequence contentDescription)
void
setContextClickable(boolean contextClickable)
void
setDefaultFocusHighlightEnabled(boolean defaultFocusHighlightEnabled)
void

This method is deprecated.

void
setDrawingCacheEnabled(boolean enabled)

This method is deprecated.

void

This method is deprecated.

void
void
setElevation(float elevation)
void
setEnabled(boolean enabled)
void
setFadingEdgeLength(int length)
void
void
setFitsSystemWindows(boolean fitSystemWindows)
void
setFocusable(boolean focusable)
void
setFocusableInTouchMode(boolean focusableInTouchMode)
void
setFocusedByDefault(boolean isFocusedByDefault)
void
setForceDarkAllowed(boolean allow)
void
setForeground(Drawable foreground)
void
setForegroundGravity(int gravity)
void
void
void
void
setHandwritingBoundsOffsets(
    float offsetLeft,
    float offsetTop,
    float offsetRight,
    float offsetBottom
)
void
void
setHapticFeedbackEnabled(boolean hapticFeedbackEnabled)
void
setHasTransientState(boolean hasTransientState)
void
setHorizontalFadingEdgeEnabled(boolean horizontalFadingEdgeEnabled)
void
setHorizontalScrollBarEnabled(boolean horizontalScrollBarEnabled)
void
void
void
setHovered(boolean hovered)
void
setId(int id)
void
void
void
void
setIsCredential(boolean isCredential)
void
setIsHandwritingDelegate(boolean isHandwritingDelegate)
void
setKeepScreenOn(boolean keepScreenOn)
void
setKeyboardNavigationCluster(boolean isCluster)
void
setLabelFor(int id)
void
void
setLayerType(int layerType, Paint paint)
void
setLayoutDirection(int layoutDirection)
void
final void
setLeft(int left)
final void
setLeftTopRightBottom(int left, int top, int right, int bottom)
void
setLongClickable(boolean longClickable)
final void
setMeasuredDimension(int measuredWidth, int measuredHeight)
void
setMinimumHeight(int minHeight)
void
setMinimumWidth(int minWidth)
void
setNestedScrollingEnabled(boolean enabled)
void
setNextClusterForwardId(int nextClusterForwardId)
void
setNextFocusDownId(int nextFocusDownId)
void
setNextFocusForwardId(int nextFocusForwardId)
void
setNextFocusLeftId(int nextFocusLeftId)
void
setNextFocusRightId(int nextFocusRightId)
void
setNextFocusUpId(int nextFocusUpId)
void
void
void
void
void
void
void
void
void
void
void
void
setOnReceiveContentListener(
    String[] mimeTypes,
    OnReceiveContentListener listener
)
void
void

This method is deprecated.

void
void
void
void
void
setOverScrollMode(int overScrollMode)
void
setPadding(int left, int top, int right, int bottom)
void
setPaddingRelative(int start, int top, int end, int bottom)
void
setPivotX(float pivotX)
void
setPivotY(float pivotY)
void
final void
setPreferKeepClear(boolean preferKeepClear)
final void
void
setPressed(boolean pressed)
void
final void
setRevealOnFocusHint(boolean revealOnFocus)
final void
setRight(int right)
void
setRotation(float rotation)
void
setRotationX(float rotationX)
void
setRotationY(float rotationY)
void
setSaveEnabled(boolean enabled)
void
setSaveFromParentEnabled(boolean enabled)
void
setScaleX(float scaleX)
void
setScaleY(float scaleY)
void
setScreenReaderFocusable(boolean screenReaderFocusable)
void
setScrollBarDefaultDelayBeforeFade(
    int scrollBarDefaultDelayBeforeFade
)
void
setScrollBarFadeDuration(int scrollBarFadeDuration)
void
setScrollBarSize(int scrollBarSize)
void
setScrollBarStyle(int style)
final void
void
void
setScrollContainer(boolean isScrollContainer)
void
setScrollIndicators(int indicators)
void
setScrollX(int value)
void
setScrollY(int value)
void
setScrollbarFadingEnabled(boolean fadeScrollbars)
void
setSelected(boolean selected)
void
setSoundEffectsEnabled(boolean soundEffectsEnabled)
void
void
void
void
setSystemUiVisibility(int visibility)

This method is deprecated.

void
void
setTextAlignment(int textAlignment)
void
setTextDirection(int textDirection)
void
final void
setTop(int top)
void
void
setTransitionAlpha(float alpha)
final void
setTransitionName(String transitionName)
void
setTransitionVisibility(int visibility)
void
setTranslationX(float translationX)
void
setTranslationY(float translationY)
void
setTranslationZ(float translationZ)
void
setVerticalFadingEdgeEnabled(boolean verticalFadingEdgeEnabled)
void
setVerticalScrollBarEnabled(boolean verticalScrollBarEnabled)
void
void
void
void
void
setVisibility(int visibility)
void
setWillNotCacheDrawing(boolean willNotCacheDrawing)

This method is deprecated.

void
setWillNotDraw(boolean willNotDraw)
void
void
setX(float x)
void
setY(float y)
void
setZ(float z)
boolean
ActionMode
void
final boolean
startDrag(
    ClipData data,
    View.DragShadowBuilder shadowBuilder,
    Object myLocalState,
    int flags
)

This method is deprecated.

final boolean
startDragAndDrop(
    ClipData data,
    View.DragShadowBuilder shadowBuilder,
    Object myLocalState,
    int flags
)
boolean
void
String
void
void
void
final void
boolean
boolean

This method is deprecated.

boolean

Public constructors

CurvedTextView

Added in 1.2.0
public CurvedTextView(@NonNull Context context)

CurvedTextView

Added in 1.2.0
public CurvedTextView(@NonNull Context context, @Nullable AttributeSet attrs)

CurvedTextView

Added in 1.2.0
public CurvedTextView(
    @NonNull Context context,
    @Nullable AttributeSet attrs,
    int defStyle
)

CurvedTextView

Added in 1.2.0
public CurvedTextView(
    @NonNull Context context,
    @Nullable AttributeSet attrs,
    int defStyle,
    int defStyleRes
)

Public methods

checkInvalidAttributeAsChild

Added in 1.4.0-alpha01
public void checkInvalidAttributeAsChild()
Throws
java.lang.IllegalArgumentException

if the anchorType and/or anchorAngleDegrees attributes were set for a widget in ArcLayout

draw

public void draw(@NonNull Canvas canvas)

getAnchorAngleDegrees

Added in 1.2.0
public @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float getAnchorAngleDegrees()

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

getAnchorType

Added in 1.2.0
public int getAnchorType()

Returns the anchor type for positioning the curved text

getEllipsize

Added in 1.2.0
public @Nullable TextUtils.TruncateAt getEllipsize()

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

getFontFeatureSettings

Added in 1.2.0
public @Nullable String getFontFeatureSettings()

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

Returns
@Nullable String

The currently set font feature settings. Default is null.

getFontVariationSettings

Added in 1.2.0
public @Nullable String getFontVariationSettings()

Returns TrueType or OpenType font variation settings.

getLetterSpacing

Added in 1.2.0
public float getLetterSpacing()

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

Returns
float

The text letter-space value in ems.

getMaxSweepDegrees

Added in 1.2.0
public @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float getMaxSweepDegrees()

Returns the maximum sweep angle in degrees for rendering the text

getMinSweepDegrees

Added in 1.2.0
public @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float getMinSweepDegrees()

Returns the sweep angle in degrees for rendering the text

getSweepAngleDegrees

Added in 1.4.0-alpha01
public @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float getSweepAngleDegrees()

Returns the sweep angle that this widget is drawn with.

getText

Added in 1.2.0
public @Nullable String getText()

Returns the text to be rendered

getTextColor

Added in 1.2.0
public @ColorInt int getTextColor()

Returns the color for rendering the text

getTextSize

Added in 1.2.0
public float getTextSize()

Returns the text size for rendering the text

getThickness

Added in 1.4.0-alpha01
public @Px int getThickness()

Returns the thickness of this widget inside the arc.

getTypeface

Added in 1.2.0
public @Nullable Typeface getTypeface()

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

isClockwise

Added in 1.2.0
public boolean isClockwise()

Returns the curved text layout direction

isPointInsideClickArea

Added in 1.4.0-alpha01
public boolean isPointInsideClickArea(float x, float y)

See isPointInsideClickArea

onInitializeAccessibilityNodeInfo

public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info)

onPopulateAccessibilityEvent

public void onPopulateAccessibilityEvent(@NonNull AccessibilityEvent event)

onTouchEvent

public boolean onTouchEvent(@NonNull MotionEvent event)

setAnchorAngleDegrees

Added in 1.2.0
public void setAnchorAngleDegrees(
    @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float value
)

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

setAnchorType

Added in 1.2.0
public void setAnchorType(int value)

Sets the anchor type for positioning the curved text.

Parameters
int value

the anchor type, one of {ANCHOR_START, ANCHOR_CENTER, ANCHOR_END}

setClockwise

Added in 1.2.0
public void setClockwise(boolean value)

Sets the curved text layout direction

setEllipsize

Added in 1.2.0
public void setEllipsize(@Nullable TextUtils.TruncateAt value)

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

setFontFeatureSettings

Added in 1.2.0
public void setFontFeatureSettings(@Nullable String value)

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
@Nullable String value

Font feature settings represented as CSS compatible string. This value may be null.

setFontVariationSettings

Added in 1.2.0
public void setFontVariationSettings(@Nullable String value)

Sets TrueType or OpenType font variation settings.

Parameters
@Nullable String value

Font variation settings. You can pass null or empty string as no variation settings. This value may be null

setLetterSpacing

Added in 1.2.0
public void setLetterSpacing(float value)

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

Parameters
float value

A text letter-space value in ems.

setSweepAngleDegrees

public void setSweepAngleDegrees(
    @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float angleDegrees
)

Set the sweep angle that this widget is drawn with. This is only called during layout, and only if the mWeight is non-zero. Note your widget will need to handle alignment.

setSweepRangeDegrees

Added in 1.2.0
public void setSweepRangeDegrees(
    @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float minSweep,
    @FloatRange(from = 0.0, to = 360.0, toInclusive = true) float maxSweep
)

Sets the minimum and maximum sweep angle in degrees for rendering the text.

Parameters
@FloatRange(from = 0.0, to = 360.0, toInclusive = true) float minSweep

Ensure the text takes at least this angle (in degrees) in the arc. Use 0f if you don't want to specify a minimum.

@FloatRange(from = 0.0, to = 360.0, toInclusive = true) float maxSweep

Limit the maximum angle (in degrees) that this curved text can take. Use 360f if you don't want to specify a maximum.

setText

Added in 1.2.0
public void setText(@Nullable String value)

Sets the text to be rendered

setTextColor

Added in 1.2.0
public void setTextColor(@ColorInt int value)

Sets the color for rendering the text

setTextSize

Added in 1.2.0
public void setTextSize(float value)

Sets the text size for rendering the text

setTypeface

Added in 1.2.0
public void setTypeface(@Nullable Typeface value)

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

setTypeface

Added in 1.2.0
public void setTypeface(@Nullable Typeface tf, int style)

Sets the typeface and style in which the text should be displayed, and turns on the fake bold and italic bits in the Paint if the Typeface that you provided does not have all the bits in the style that you specified.

Protected methods

onDraw

protected void onDraw(@NonNull Canvas canvas)

onMeasure

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

onSizeChanged

protected void onSizeChanged(int w, int h, int oldw, int oldh)