An em is a term used in typography that is defined in terms of the point size

An em is a term used in typography that is defined in

This preview shows page 13 - 21 out of 99 pages.

An em is a term used in typography that is defined in terms of the point size of a particular font. For example, the measure of an em in a 12-point font is 12 points. This measurement provides better control over how much text is viewed, regardless of the font size. Through the ems attribute, you can set the width of the TextView . Additionally, you can use the maxEms and minEms attributes to set the maximum width and minimum width, respectively, of the TextView in terms of ems.
Image of page 13

Subscribe to view the full document.

Configuring Layout and Sizing (Cont’d) The height of a TextView can be set in terms of lines of text rather than pixels. This is useful for controlling how much text can be viewed regardless of the font size. The lines attribute sets the number of lines that the TextView can display. You can also use maxLines and minLines to control the maximum height and minimum height, respectively, that the TextView displays.
Image of page 14
Configuring Layout and Sizing (Cont’d) <TextView android:id="@+id/TextView04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:lines="2" android:ems="12" android:text="@string/autolink_test" /> Here is an example that combines these two types of sizing attributes. This TextView is two lines of text high and 12 ems of text wide. The layout width and height are specified to the size of the TextView and are required attributes in the XML schema.
Image of page 15

Subscribe to view the full document.