MaskableFrameLayout

public class MaskableFrameLayout
extends FrameLayout implements Shapeable

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ com.google.android.material.carousel.MaskableFrameLayout


A FrameLayout than is able to mask itself and all children.

Summary

Inherited constants

Inherited fields

Public constructors

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

Public methods

void getFocusedRect(Rect r)
RectF getMaskRectF()

Gets a RectF that this View is masked itself by.

float getMaskXPercentage()

This method is deprecated. This is no longer used as CarouselLayoutManager calculates its own mask percentages.

ShapeAppearanceModel getShapeAppearanceModel()

Returns the ShapeAppearanceModel used for the shape definition.

boolean onTouchEvent(MotionEvent event)
void setMaskRectF(RectF maskRect)

Sets the RectF that this View will be masked by.

void setMaskXPercentage(float percentage)

This method is deprecated. This is no longer used as CarouselLayoutManager calculates its own mask percentages.

void setOnMaskChangedListener(OnMaskChangedListener onMaskChangedListener)
void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel)

Sets the ShapeAppearanceModel that defines the shape.

Protected methods

void dispatchDraw(Canvas canvas)
void onAttachedToWindow()
void onDetachedFromWindow()
void onSizeChanged(int w, int h, int oldw, int oldh)

Inherited methods

Public constructors

MaskableFrameLayout

public MaskableFrameLayout (Context context)

Parameters
context Context

MaskableFrameLayout

public MaskableFrameLayout (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

MaskableFrameLayout

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

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

getFocusedRect

public void getFocusedRect (Rect r)

Parameters
r Rect

getMaskRectF

public RectF getMaskRectF ()

Gets a RectF that this View is masked itself by.

Returns
RectF

getMaskXPercentage

public float getMaskXPercentage ()

This method is deprecated.
This is no longer used as CarouselLayoutManager calculates its own mask percentages.

Gets the percentage by which this View is masked by along the x axis.

Returns
float a float between 0 and 1 where 0 is fully unmasked and 1 is fully masked.

getShapeAppearanceModel

public ShapeAppearanceModel getShapeAppearanceModel ()

Returns the ShapeAppearanceModel used for the shape definition.

This ShapeAppearanceModel can be modified to change the shape.

Returns
ShapeAppearanceModel

onTouchEvent

public boolean onTouchEvent (MotionEvent event)

Parameters
event MotionEvent

Returns
boolean

setMaskRectF

public void setMaskRectF (RectF maskRect)

Sets the RectF that this View will be masked by.

Parameters
maskRect RectF: a rect in the view's coordinates to mask by

setMaskXPercentage

public void setMaskXPercentage (float percentage)

This method is deprecated.
This is no longer used as CarouselLayoutManager calculates its own mask percentages.

Sets the percentage by which this View masks by along the x axis.

Parameters
percentage float: 0 when this view is fully unmasked. 1 when this view is fully masked.

setOnMaskChangedListener

public void setOnMaskChangedListener (OnMaskChangedListener onMaskChangedListener)

Parameters
onMaskChangedListener OnMaskChangedListener

setShapeAppearanceModel

public void setShapeAppearanceModel (ShapeAppearanceModel shapeAppearanceModel)

Sets the ShapeAppearanceModel that defines the shape.

Parameters
shapeAppearanceModel ShapeAppearanceModel

Protected methods

dispatchDraw

protected void dispatchDraw (Canvas canvas)

Parameters
canvas Canvas

onAttachedToWindow

protected void onAttachedToWindow ()

onDetachedFromWindow

protected void onDetachedFromWindow ()

onSizeChanged

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

Parameters
w int

h int

oldw int

oldh int