MobileUI LogoMobileUI
/

View


The View is the base class of all UI components. It defines common attributes and can be used itself, e.g. for realizing rulers and areas on the screen.

Usage

Using a View as horizontal line
<View width="fill_parent" height="1dp" margin="8dp" backgroundColor="gray"/>
Using a View as vertical line
<View width="1dp" height="fill_parent" margin="2dp" backgroundColor="black"/>

Attributes

NameTypeDefaultBindingDescription

width

sizeType

wrap_content

output

Width of the view in dp, cm, mm or one of the key words wrap_content or fill_parent

height

sizeType

wrap_content

output

Height of the view in dp, cm, mm or one of the key words wrap_content or fill_parent

minWidth

sizeType

output

Defines the minimum width of the view. It is not guaranteed the view will be able to achieve this minimum width (for example, if its parent layout constrains it with less available width).

minHeight

sizeType

output

Defines the minimum height of the view. It is not guaranteed the view will be able to achieve this minimum height (for example, if its parent layout constrains it with less available height).

marginTop

sizeType

output

Sets the margin, of the top edge; see margin.

marginBottom

sizeType

output

Sets the margin, of the top edge; see margin.

marginLeft

sizeType

output

Sets the margin, of the left edge; see margin.

marginRight

sizeType

output

Sets the margin, of the right edge; see margin.

margin

sizeType

output

Sets the margin of all four edges. Margin is defined as space between the edges of the view and the edges of other views in the layout. A view’s size will exclude it’s margin.

paddingTop

sizeType

output

Sets the padding, of the top edge; see padding.

paddingBottom

sizeType

output

Sets the padding, of the top edge; see padding.

paddingLeft

sizeType

output

Sets the padding, of the left edge; see padding.

paddingRight

sizeType

output

Sets the padding, of the right edge; see padding.

padding

sizeType

output

Sets the padding of all four edges. Padding is defined as space between the edges of the view and the view’s content. A view’s size will include it’s padding.

alpha

float

1.0

output

Alpha value between 0.0 (transparent) and 1.0 (opaque)

backgroundColor

colorType

output

Defines a color for the view’s background.

backgroundImage

URI

output

Defines an image for the view’s background. You might consider using a 9-patch SVG in this case.

backgroundScale

double

1.0

output

Use this attribute to scale a backgroundImage.

enabled

boolean

true

output

Enables or disables this view. This is useful for sub-classes of the View like Buttons and other input components.

visibility

enum

visible

output

Controls the initial visibility of the view. Must be one of the following constant values: visibile (Visible on screen; the default value), invisible (Not displayed, but taken into account during layout / space is left for it), gone (Completely hidden, as if the view had not been added)

visible

boolean

true

output

Shortcut for visiblity switching between 'visible' and 'gone' (see visibility)

horizontalAlign

enum

left

output

Determines the view’s alignment in its parent. Can be one of left, center, right or fill

verticalAlign

enum

top

output

Determines the view’s alignment in its parent. Can be one of top, center, bottom or fill

class

string

Attaches one or more CSS classes to this view.

onClick

expression

action

Holds an expression that is executed when the user taps or clicks on the view.


Parts of this documentation are a derivate of the Android Developer Documentation by Google used under CC-BY-2.5.