Android Tutorial

(avery) #1

By : Ketan Bhimani


140 

int myResourceColor
=getResources().getColor(R.color.prettyTextColor);

Working with Dimensions

Many user interface layout controls such as text controls and
buttons are drawn to specific dimensions. These dimensions can be
stored as resources. Dimension values always end with a unit of
measurement tag.

Dimension values are appropriately tagged with the <dimen> tag
and represent a name value pair. Dimension resources are defined
in XML under the /res/values project directory and compiled into
the application package at build time.

The dimension units supported are shown in Table.

Dimension Unit Measurements Supported

Here’s an example of a simple dimension resource file
/res/values/dimens.xml:
Free download pdf