What is meant by Ems? (Android TextView)

前端 未结 7 1197
情歌与酒
情歌与酒 2020-11-29 15:27

What is meant by Ems (related to a TextView)? For example in

android:ems     setEms(int)

Makes the TextView be exactly this many ems wide.<

相关标签:
7条回答
  • 2020-11-29 16:25

    It is the width of the letter M in a given English font size.
    So 2em is twice the width of the letter M in this given font.
    For a non-English font, it is the width of the widest letter in that font. This width size in pixels is different than the width size of the M in the English font but it is still 1em.
    So if I use a text with 12sp in an English font, 1em is relative to this 12sp English font; using an Italian font with 12sp gives 1em that is different in pixels width than the English one.

    0 讨论(0)
提交回复
热议问题