# ActivityInfo.WindowLayout

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[XML Attrs](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#lattrs)\|[Fields](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#lfields)\|[Ctors](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#pubctors)\|[Inherited Methods](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#inhmethods)  

# ActivityInfo.WindowLayout

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/content/pm/ActivityInfo.WindowLayout "View this page in Kotlin")\|Java

`
public
static
final

class
ActivityInfo.WindowLayout
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|----------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.pm.ActivityInfo.WindowLayout |

<br />

*** ** * ** ***

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`](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#attr_android:defaultHeight) | Default height of the activity.                                      |
| [`android:defaultWidth`](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#attr_android:defaultWidth)   | Default width of the activity.                                       |
| [`android:gravity`](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#attr_android:gravity)             | Where to initially position the activity inside the available space. |
| [`android:minHeight`](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#attr_android:minHeight)         | Minimal height of the activity.                                      |
| [`android:minWidth`](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#attr_android:minWidth)           | Minimal width of the activity.                                       |

|                                                                                                 ### Fields                                                                                                 ||
|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` public final int`   | [gravity](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#gravity) Gravity of activity.                                                        |
| ` public final int`   | [height](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#height) Height of activity in pixels.                                                 |
| ` public final float` | [heightFraction](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#heightFraction) Height of activity as a fraction of available display height. |
| ` public final int`   | [minHeight](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#minHeight) Minimal height of activity in pixels to be able to display its content. |
| ` public final int`   | [minWidth](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#minWidth) Minimal width of activity in pixels to be able to display its content.    |
| ` public final int`   | [width](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#width) Width of activity in pixels.                                                    |
| ` public final float` | [widthFraction](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#widthFraction) Width of activity as a fraction of available display width.     |

|                                                                                                                                  ### Public constructors                                                                                                                                  ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[WindowLayout](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#WindowLayout(int,%20float,%20int,%20float,%20int,%20int,%20int))`(int width, float widthFraction, int height, float heightFraction, int gravity, int minWidth, int minHeight) ` |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## XML attributes

### android:defaultHeight

Default height of the activity. Can be either a fixed value or fraction, in which case the height will be constructed as a fraction of the total available height.

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.

<br />

### android:defaultWidth

Default width of the activity. Can be either a fixed value or fraction, in which case the width will be constructed as a fraction of the total available width.

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.

<br />

### android:gravity

Where to initially position the activity inside the available space. Uses constants defined in[Gravity](https://developer.android.com/reference/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.                                                                                                                                                                                                                             |

<br />

<br />

### android:minHeight

Minimal height of the activity.

**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).

<br />

### android:minWidth

Minimal width of the activity.

**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).

<br />

## Fields

### gravity

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public final int gravity
```

Gravity of activity. Currently[Gravity.TOP](https://developer.android.com/reference/android/view/Gravity#TOP),[Gravity.BOTTOM](https://developer.android.com/reference/android/view/Gravity#BOTTOM),[Gravity.LEFT](https://developer.android.com/reference/android/view/Gravity#LEFT)and[Gravity.RIGHT](https://developer.android.com/reference/android/view/Gravity#RIGHT)are supported.

<br />

### height

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public final int height
```

Height of activity in pixels.

<br />

### heightFraction

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public final float heightFraction
```

Height of activity as a fraction of available display height. If both[height](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#height)and this value are set this one will be preferred.

<br />

### minHeight

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public final int minHeight
```

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.

<br />

### minWidth

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public final int minWidth
```

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.

<br />

### width

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public final int width
```

Width of activity in pixels.

<br />

### widthFraction

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public final float widthFraction
```

Width of activity as a fraction of available display width. If both[width](https://developer.android.com/reference/android/content/pm/ActivityInfo.WindowLayout#width)and this value are set this one will be preferred.

<br />

## Public constructors

### WindowLayout

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public WindowLayout (int width, 
                float widthFraction, 
                int height, 
                float heightFraction, 
                int gravity, 
                int minWidth, 
                int minHeight)
```

<br />

<br />

|            Parameters            ||
|------------------|----------------|
| `width`          | `int` <br />   |
| `widthFraction`  | `float` <br /> |
| `height`         | `int` <br />   |
| `heightFraction` | `float` <br /> |
| `gravity`        | `int` <br />   |
| `minWidth`       | `int` <br />   |
| `minHeight`      | `int` <br />   |