ProtectionLayout
class ProtectionLayout : FrameLayout
| kotlin.Any | ||||
| ↳ | android.view.View | |||
| ↳ | android.view.ViewGroup | |||
| ↳ | android.widget.FrameLayout | |||
| ↳ | androidx.core.view.insets.ProtectionLayout |
A layout drawing views under system bars, called Protections, to ensure enough contrast between the system bars (such as status bar and navigation bar) and the app content.
This layout is meant to be used in edge-to-edge scenarios. The Protections are set using the setProtections method or directly in the view constructor.
If this view will be attached to a hierarchy owned by a Window, it is strongly recommended to call enableEdgeToEdge to make sure the view can reach the edges of the window and the framework color views are gone.
Summary
Public constructors |
|---|
ProtectionLayout(context: Context) |
ProtectionLayout(context: Context, attrs: AttributeSet?) |
ProtectionLayout(Constructs a view which draws protections contained in the specified list. |
ProtectionLayout( |
ProtectionLayout( |
Public functions |
|
|---|---|
Unit |
addView(child: View?, index: Int, params: ViewGroup.LayoutParams?) |
Unit |
setProtections(protections: (Mutable)List<Protection!>)Replaces existing |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Public constructors
ProtectionLayout
ProtectionLayout(
context: Context,
protections: (Mutable)List<Protection!>
)
Constructs a view which draws protections contained in the specified list.
| Parameters | |
|---|---|
context: Context |
the Context the view is running in, through which it can access the current theme, resources, etc. |
protections: (Mutable)List<Protection!> |
a list of protections associated with a local area. |
ProtectionLayout
ProtectionLayout(
context: Context,
attrs: AttributeSet?,
defStyleAttr: @AttrRes Int
)
ProtectionLayout
ProtectionLayout(
context: Context,
attrs: AttributeSet?,
defStyleAttr: @AttrRes Int,
defStyleRes: @StyleRes Int
)
Public functions
setProtections
fun setProtections(protections: (Mutable)List<Protection!>): Unit
Replaces existing Protections with the given ones. Calling this with an empty list will remove all the protections.
| Parameters | |
|---|---|
protections: (Mutable)List<Protection!> |
a list of protections associated with a local area. |