1

I am new to the android application development. I am developing an application. While doing design for this app i am stuck in android:ems. What is this components.

2 Answers2

1

The em is simply the font size. In an element with a 2in font, 1em thus means 2in. Expressing sizes, such as margins and paddings, in em means they are related to the font size, and if the user has a big font (e.g., on a big screen) or a small font (e.g., on a handheld device), the sizes will be in proportion. Declarations such as 'text-indent: 1.5em' and 'margin: 1em' are extremely common in CSS.

em is basically CSS property for font sizes

android:ems or setEms(n) sets the width of a TextView to fit a text of n 'M' letters regardless of the actual text extension and text size. See wikipedia Em unit

but only when the layout_width is set to "wrap_content". Other layout_width values override the ems width setting.

Adding an android:textSize attribute determines the physical width of the view to the textSize * length of a text of n 'M's set above.

0

An em is a unit in the field of typography, equal to the currently specified point size.

More information about ems: wikipedia

More information about ems in Android doc

Makes the TextView exactly this many ems wide by using setEms (int ems)