什么是编辑文本中的 android:ems 属性?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10275348/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:06:12  来源:igfitidea点击:

What is android:ems attribute in Edit Text?

android

提问by Chirag

Possible Duplicate:
What means Ems? (Android TextView)

可能的重复:
Ems 是什么意思?(Android TextView)

In EditTextthere is an attribute named android:ems. The description is "Makes the EditTextbe exactly this many ems wide"

其中EditText有一个名为android:ems. 描述是“使EditText宽度正好有这么多 em”

What does ems mean?

ems是什么意思?

采纳答案by Boris Strandjev

Taken from: http://www.w3.org/Style/Examples/007/units:

取自:http: //www.w3.org/Style/Examples/007/units

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 只是字体大小。在具有 2in 字体的元素中,1em 因此意味着 2in。em 中表示边距和内边距等大小,表示它们与字体大小有关,如果用户有大字体(例如,在大屏幕上)或小字体(例如,在手持设备上),大小将成比例。诸如 'text-indent: 1.5em' 和 'margin: 1em' 之类的声明在 CSS 中极为常见。

emis basically CSS property for font sizes.

em基本上是字体大小的 CSS 属性。

回答by adneal

An "em" is a typographical unit of width, the width of a wide-ish letter like "m" pronounced "em". Similarly there is an "en". Similarly "en-dash" and "em-dash" for – and —

“em”是宽度的印刷单位,是像“m”这样发音为“em”的宽字母的宽度。同样有一个“en”。类似地,“en-dash”和“em-dash”用于 – 和 –

-Tim Bray

-蒂姆·布雷