How the android:ems (TextView) attribute works


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

I saw something mentioning that he acts on the source of the text, but I didn't understand how. I tried to run some tests, and I didn't notice any result.

Does anyone know how it acts on a TextView ?


The ems is used to define the width of the components with respect to the current font, so your TextView will have the necessary width to show the amount of characters that you define using the ems .

However to be effective it is necessary to set the layout_width to wrap_content as the other layout types wrap_content the ems width setting.

Scroll to Top