MotionButton

public class MotionButton
extends AppCompatButton

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.Button
         ↳ androidx.appcompat.widget.AppCompatButton
           ↳ androidx.constraintlayout.utils.widget.MotionButton


An ImageButton that can display, combine and filter images. Added in 2.0

Subclass of AppCompatButton to handle rounding edges dynamically.

MotionButton attributes

round (id) call the TransitionListener with this trigger id roundPercent Set the corner radius of curvature as a fraction of the smaller side. For squares 1 will result in a circle round Set the corner radius of curvature as a fraction of the smaller side. For squares 1 will result in a circle

Summary

Inherited constants

Inherited fields

Public constructors

MotionButton(Context context)
MotionButton(Context context, AttributeSet attrs)
MotionButton(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

void draw(Canvas canvas)
float getRound()

Get the corner radius of curvature NaN = RoundPercent in effect.

float getRoundPercent()

Get the fractional corner radius of curvature.

void setRound(float round)

Set the corner radius of curvature

void setRoundPercent(float round)

Set the corner radius of curvature as a fraction of the smaller side.

Inherited methods

Public constructors

MotionButton

public MotionButton (Context context)

Parameters
context Context

MotionButton

public MotionButton (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

MotionButton

public MotionButton (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

draw

public void draw (Canvas canvas)

Parameters
canvas Canvas

getRound

public float getRound ()

Get the corner radius of curvature NaN = RoundPercent in effect.

Returns
float Radius of curvature

getRoundPercent

public float getRoundPercent ()

Get the fractional corner radius of curvature.

Returns
float Fractional radius of curvature with respect to smallest size

setRound

public void setRound (float round)

Set the corner radius of curvature

Parameters
round float: the radius of curvature NaN = default meaning roundPercent in effect

setRoundPercent

public void setRoundPercent (float round)

Set the corner radius of curvature as a fraction of the smaller side. For squares 1 will result in a circle

Parameters
round float: the radius of curvature as a fraction of the smaller width