@UnstableApi
public final class Size


Immutable class for describing width and height dimensions in pixels.

Summary

Constants

static final Size

A static instance to represent an unknown size value.

static final Size

Public fields

final int
final int

Public constructors

Size(int width, int height)

Creates a new immutable Size instance.

Public methods

boolean
int

Returns the height of the size (in pixels), or LENGTH_UNSET if unknown.

int

Returns the width of the size (in pixels), or LENGTH_UNSET if unknown.

int
String

Constants

UNKNOWN

public static final Size UNKNOWN

A static instance to represent an unknown size value.

ZERO

public static final Size ZERO

Public fields

height

public final int height

width

public final int width

Public constructors

Size

public Size(int width, int height)

Creates a new immutable Size instance.

Parameters
int width

The width of the size, in pixels, or LENGTH_UNSET if unknown.

int height

The height of the size, in pixels, or LENGTH_UNSET if unknown.

Throws
java.lang.IllegalArgumentException

if an invalid width or height is specified.

Public methods

equals

public boolean equals(@Nullable Object obj)

getHeight

public int getHeight()

Returns the height of the size (in pixels), or LENGTH_UNSET if unknown.

getWidth

public int getWidth()

Returns the width of the size (in pixels), or LENGTH_UNSET if unknown.

hashCode

public int hashCode()

toString

public String toString()