public class Label
A label of text attached to a view of the ExpandableFab widget.
Developer Notes:
Different views within the ExpandableFab widget can be labeled (like ExpandableFab and FabOption). Each labeled view will set their own default values for the properties of their specific label. Look at the documentation for the label property declared in each of theses classes to see what the default values of their labels are.
Implementation Notes:
Since the Kotlin 'internal' modifier translates to 'public' in Java, the JvmSynthetic annotation is used on those functions and properties to hide them from the published API for Java clients. A proper solution to this issue would be a package-private visibility modifier, but Kotlin has yet to implement it (https://youtrack.jetbrains.com/issue/KT-29227). Until then, the JvmSynthetic annotations should remain in order to present the proper published API to both Java & Kotlin clients.
public Label(@NotNull android.content.Context context)
Used to create a Label programmatically. Clients should not need to call this directly as all labeled Views of the ExpandableFab widget already create their own labels which can be retrieved and modified (but not reassigned) as needed.
@Nullable public java.lang.CharSequence getLabelText()
The text of the Label. Can be set to null to hide the label. Usage of this property is preferred over the inherited set/getText methods.
public void setLabelText(@Nullable java.lang.CharSequence value)
The text of the Label. Can be set to null to hide the label. Usage of this property is preferred over the inherited set/getText methods.
public int getLabelTextColor()
The color of the Label's text. Usage of this property is preferred over the inherited setTextColor method variations.
public void setLabelTextColor(int value)
The color of the Label's text. Usage of this property is preferred over the inherited setTextColor method variations.
public float getLabelTextSize()
The size of the Label's text, as a float. Retrieve this value in the correct form from your dimens.xml file using: resources.getDimension(R.dimen.name_of_text_size). Text sizes should use sp as the unit. Usage of this property is preferred over the inherited set/getTextSize methods.
public void setLabelTextSize(float value)
The size of the Label's text, as a float. Retrieve this value in the correct form from your dimens.xml file using: resources.getDimension(R.dimen.name_of_text_size). Text sizes should use sp as the unit. Usage of this property is preferred over the inherited set/getTextSize methods.
public int getLabelBackgroundColor()
The color of the Label's background. Usage of this property is preferred over the inherited setBackgroundColor method.
public void setLabelBackgroundColor(int value)
The color of the Label's background. Usage of this property is preferred over the inherited setBackgroundColor method.
public int getLabelElevation()
The elevation of the Label, in pixels as a positive float. Retrieve this value in the correct form from your dimens.xml file using: resources.getDimensionPixelSize(R.dimen.name_of_elevation_size). Usage of this property is preferred over the inherited set/getElevation methods.
public void setLabelElevation(int value)
The elevation of the Label, in pixels as a positive float. Retrieve this value in the correct form from your dimens.xml file using: resources.getDimensionPixelSize(R.dimen.name_of_elevation_size). Usage of this property is preferred over the inherited set/getElevation methods.
@NotNull public LabelPosition getPosition()
The Label's enum LabelPosition
, in relation to the view it's attached to.
enum LabelPosition
public void setPosition(@NotNull LabelPosition p)
The Label's enum LabelPosition
, in relation to the view it's attached to.
enum LabelPosition
public float getMarginPx()
The margin (in pixels as a positive float) between the Label and the view it is attached to.
Negative values are not allowed since clients should likely be changing the Label's
position
if they wanted to move the Label to the opposite side of the view it's attached
to.
position
public void setMarginPx(float value)
The margin (in pixels as a positive float) between the Label and the view it is attached to.
Negative values are not allowed since clients should likely be changing the Label's
position
if they wanted to move the Label to the opposite side of the view it's attached
to.
position
public float getTranslationXPx()
The distance (in pixels as a float) the Label will travel horizontally during animations. A negative value will make the Label travel to the left, while a positive value will make it travel to the right. See its use in visibleToHiddenAnimations and hiddenToVisibleAnimations.
public void setTranslationXPx(float p)
The distance (in pixels as a float) the Label will travel horizontally during animations. A negative value will make the Label travel to the left, while a positive value will make it travel to the right. See its use in visibleToHiddenAnimations and hiddenToVisibleAnimations.
public long getVisibleToHiddenAnimationDurationMs()
The duration (in milliseconds as a positive long) of the animations that the Label will play when going from a visible to hidden state.
public void setVisibleToHiddenAnimationDurationMs(long value)
The duration (in milliseconds as a positive long) of the animations that the Label will play when going from a visible to hidden state.
public long getHiddenToVisibleAnimationDurationMs()
The duration (in milliseconds as a positive long) of the animations that the Label will play when going from a hidden to visible state.
public void setHiddenToVisibleAnimationDurationMs(long value)
The duration (in milliseconds as a positive long) of the animations that the Label will play when going from a hidden to visible state.
public float getOvershootTension()
The tension (as a positive float) in an OvershootInterpolator applied on the Label when it is being shown from a hidden state. Larger values will exaggerate the effect more.
The OvershootInterpolator allows us to have an animation where the Label will fling past
its marginPx
when initially appearing, before smoothly coming back toward its marginPx
value.
public void setOvershootTension(float value)
The tension (as a positive float) in an OvershootInterpolator applied on the Label when it is being shown from a hidden state. Larger values will exaggerate the effect more.
The OvershootInterpolator allows us to have an animation where the Label will fling past
its marginPx
when initially appearing, before smoothly coming back toward its marginPx
value.
public boolean onTouchEvent(@Nullable android.view.MotionEvent event)
Scales the Label down when pressed, and back up when released. Gives the user some visual feedback to show that the Label was pressed.