WindowLayout
class WindowLayout
kotlin.Any | |
↳ | android.content.pm.ActivityInfo.WindowLayout |
Contains information about position and size of the activity on the display. Used in freeform mode to set desired position when activity is first launched. It describes how big the activity wants to be in both width and height, the minimal allowed size, and the gravity to be applied.
Summary
XML attributes | |
---|---|
android:defaultHeight |
Default height of the activity. |
android:defaultWidth |
Default width of the activity. |
android:gravity |
Where to initially position the activity inside the available space. |
android:minHeight |
Minimal height of the activity. |
android:minWidth |
Minimal width of the activity. |
Public constructors | |
---|---|
Properties | |
---|---|
Int |
Gravity of activity. |
Int |
Height of activity in pixels. |
Float |
Height of activity as a fraction of available display height. |
Int |
Minimal height of activity in pixels to be able to display its content. |
Int |
Minimal width of activity in pixels to be able to display its content. |
Int |
Width of activity in pixels. |
Float |
Width of activity as a fraction of available display width. |
XML attributes
android:defaultHeight
android:defaultHeight
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
May be a fractional value, which is a floating point number appended with either % or %p, such as "14.5%
". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container.
android:defaultWidth
android:defaultWidth
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
May be a fractional value, which is a floating point number appended with either % or %p, such as "14.5%
". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container.
android:gravity
android:gravity
android.view.Gravity
.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
bottom | 50 | Push object to the bottom of its container, not changing its size. |
center | 11 | Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. |
center_horizontal | 1 | Place object in the horizontal center of its container, not changing its size. |
center_vertical | 10 | Place object in the vertical center of its container, not changing its size. |
clip_horizontal | 8 | Additional option that can be set to have the left and/or right edges of the child clipped to its container's bounds. The clip will be based on the horizontal gravity: a left gravity will clip the right edge, a right gravity will clip the left edge, and neither will clip both edges. |
clip_vertical | 80 | Additional option that can be set to have the top and/or bottom edges of the child clipped to its container's bounds. The clip will be based on the vertical gravity: a top gravity will clip the bottom edge, a bottom gravity will clip the top edge, and neither will clip both edges. |
end | 800005 | Push object to the end of its container, not changing its size. |
fill | 77 | Grow the horizontal and vertical size of the object if needed so it completely fills its container. |
fill_horizontal | 7 | Grow the horizontal size of the object if needed so it completely fills its container. |
fill_vertical | 70 | Grow the vertical size of the object if needed so it completely fills its container. |
left | 3 | Push object to the left of its container, not changing its size. |
right | 5 | Push object to the right of its container, not changing its size. |
start | 800003 | Push object to the beginning of its container, not changing its size. |
top | 30 | Push object to the top of its container, not changing its size. |
android:minHeight
android:minHeight
NOTE: A task's root activity value is applied to all additional activities launched in the task. That is if the root activity of a task set minimal height, then the system will set the same minimal height on all other activities in the task. It will also ignore any other minimal height attributes of non-root activities.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:minWidth
android:minWidth
NOTE: A task's root activity value is applied to all additional activities launched in the task. That is if the root activity of a task set minimal width, then the system will set the same minimal width on all other activities in the task. It will also ignore any other minimal width attributes of non-root activities.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
Public constructors
WindowLayout
WindowLayout(
width: Int,
widthFraction: Float,
height: Int,
heightFraction: Float,
gravity: Int,
minWidth: Int,
minHeight: Int)
Properties
gravity
val gravity: Int
Gravity of activity. Currently android.view.Gravity#TOP
, android.view.Gravity#BOTTOM
, android.view.Gravity#LEFT
and android.view.Gravity#RIGHT
are supported.
heightFraction
val heightFraction: Float
Height of activity as a fraction of available display height. If both height
and this value are set this one will be preferred.
minHeight
val minHeight: Int
Minimal height of activity in pixels to be able to display its content.
NOTE: A task's root activity value is applied to all additional activities launched in the task. That is if the root activity of a task set minimal height, then the system will set the same minimal height on all other activities in the task. It will also ignore any other minimal height attributes of non-root activities.
minWidth
val minWidth: Int
Minimal width of activity in pixels to be able to display its content.
NOTE: A task's root activity value is applied to all additional activities launched in the task. That is if the root activity of a task set minimal width, then the system will set the same minimal width on all other activities in the task. It will also ignore any other minimal width attributes of non-root activities.
widthFraction
val widthFraction: Float
Width of activity as a fraction of available display width. If both width
and this value are set this one will be preferred.