ShadowOverlayContainer
class ShadowOverlayContainer : FrameLayout
| kotlin.Any | ||||
| ↳ | android.view.View | |||
| ↳ | android.view.ViewGroup | |||
| ↳ | android.widget.FrameLayout | |||
| ↳ | androidx.leanback.widget.ShadowOverlayContainer |
Provides an SDK version-independent wrapper to support shadows, color overlays, and rounded corners. It's not always preferred to create a ShadowOverlayContainer, use ShadowOverlayHelper instead.
prepareParentForShadow must be called on parent of container before using shadow. Depending on sdk version, optical bounds might be applied to parent.
If shadows can appear outside the bounds of the parent view, setClipChildren(false) must be called on the grandparent view.
initialize must be first called on the container. Then call wrap to insert the wrapped view into the container.
Call setShadowFocusLevel to control the strength of the shadow (focused shadows cast stronger shadows).
Call setOverlayColor to control overlay color.
Summary
Constants |
|
|---|---|
const Int |
SHADOW_DYNAMIC = 3Shadows depend on the size, shape, and position of the view. |
const Int |
SHADOW_NONE = 1No shadow. |
const Int |
SHADOW_STATIC = 2Shadows are fixed. |
Public constructors |
|---|
ShadowOverlayContainer(context: Context!)Create ShadowOverlayContainer and auto select shadow type. |
ShadowOverlayContainer(context: Context!, attrs: AttributeSet!)Create ShadowOverlayContainer and auto select shadow type. |
ShadowOverlayContainer(Create ShadowOverlayContainer and auto select shadow type. |
Public functions |
|
|---|---|
Unit |
|
Int |
Returns the shadow type, one of |
View! |
Returns the wrapper view. |
Boolean |
|
Unit |
This function is deprecated. use |
Unit |
This function is deprecated. use |
java-static Unit |
prepareParentForShadow(parent: ViewGroup!)
|
Unit |
setOverlayColor(overlayColor: @ColorInt Int)Set color (with alpha) of the overlay. |
Unit |
setShadowFocusLevel(level: Float)Set shadow focus level (0 to 1). |
java-static Boolean |
Returns true if the platform sdk supports dynamic shadows. |
java-static Boolean |
Return true if the platform sdk supports shadow. |
Unit |
Sets the shadow type to |
Unit |
useDynamicShadow(unfocusedZ: Float, focusedZ: Float)Sets the shadow type to |
Unit |
Sets the shadow type to |
Unit |
Inserts view into the wrapper. |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Constants
SHADOW_DYNAMIC
const val SHADOW_DYNAMIC = 3: Int
Shadows depend on the size, shape, and position of the view.
Public constructors
ShadowOverlayContainer
ShadowOverlayContainer(context: Context!)
Create ShadowOverlayContainer and auto select shadow type.
ShadowOverlayContainer
ShadowOverlayContainer(context: Context!, attrs: AttributeSet!)
Create ShadowOverlayContainer and auto select shadow type.
ShadowOverlayContainer
ShadowOverlayContainer(
context: Context!,
attrs: AttributeSet!,
defStyle: Int
)
Create ShadowOverlayContainer and auto select shadow type.
Public functions
getShadowType
fun getShadowType(): Int
Returns the shadow type, one of SHADOW_NONE, SHADOW_STATIC, or SHADOW_DYNAMIC.
funinitialize(hasShadow: Boolean, hasColorDimOverlay: Boolean): Unit
Initialize shadows, color overlay.
funinitialize(
hasShadow: Boolean,
hasColorDimOverlay: Boolean,
roundedCorners: Boolean
): Unit
Initialize shadows, color overlay, and rounded corners. All are optional. Shadow type are auto-selected based on useStaticShadow and useDynamicShadow call.
prepareParentForShadow
java-static fun prepareParentForShadow(parent: ViewGroup!): Unit
prepareParentForShadow must be called on parent of container before using shadow. Depending on sdk version, optical bounds might be applied to parent.
setOverlayColor
fun setOverlayColor(overlayColor: @ColorInt Int): Unit
Set color (with alpha) of the overlay.
setShadowFocusLevel
fun setShadowFocusLevel(level: Float): Unit
Set shadow focus level (0 to 1). 0 for unfocused, 1f for fully focused.
supportsDynamicShadow
java-static fun supportsDynamicShadow(): Boolean
Returns true if the platform sdk supports dynamic shadows.
supportsShadow
java-static fun supportsShadow(): Boolean
Return true if the platform sdk supports shadow.
useDynamicShadow
fun useDynamicShadow(): Unit
Sets the shadow type to SHADOW_DYNAMIC if supported.
useDynamicShadow
fun useDynamicShadow(unfocusedZ: Float, focusedZ: Float): Unit
Sets the shadow type to SHADOW_DYNAMIC if supported and sets the elevation/Z values to the given parameters.
useStaticShadow
fun useStaticShadow(): Unit
Sets the shadow type to SHADOW_STATIC if supported.