An emis 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 emsattribute, you can set the width of the TextView.–Additionally, you can use the maxEmsand minEmsattributes to set the maximum width and minimum width, respectively, of the TextViewin terms of ems.
Subscribe to view the full document.
Configuring Layout and Sizing (Cont’d)The height of a TextViewcan 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 linesattribute sets the number of lines that the TextViewcan display.–You can also use maxLinesand minLinesto control the maximum height and minimum height, respectively, that the TextViewdisplays.
Configuring Layout and Sizing (Cont’d)<TextViewandroid: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 TextViewis two lines of text high and 12 ems of text wide. The layout width and height are specified to the size of the TextViewand are required attributes in the XML schema.