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
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 float
static final float
static final float
static final float
static final float
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
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