How the android attribute works: ems (TextView)

5

I would like to understand how this attribute works ( android:ems ).

I saw something quoting that it acts on the source of the text, but I do not understand in what way. I tried to do some testing, and I did not notice a result.

Does anyone know how it acts on TextView ?

    
asked by anonymous 26.03.2014 / 15:38

2 answers

4
The ems is used to set the width of the components relative to the current font, so its TextView will have the width needed to show the amount of characters you set using ems .

However, in order to have an effect it is necessary to set layout_width to wrap_content , since other types of layout override the ems width setting.

    
26.03.2014 / 17:19
3

ems is a unit of length defined relative to the source used. 1em represents the length of the letter m .

When, for example, a TextView is set to the android:ems="15" attribute you are limiting the length of the TextView to 15 m .

    
26.03.2014 / 17:10