Android,android官網
控制項android:ems屬性
本文地址:http://blog.csdn.net/caroline_wendy
xml中
android:ems屬性,作為EditText
預設產生的屬性,其含義是需要編輯的
字串長度。設定為10時,最多編輯
10個em,一個em單位是
兩個inch,但是隨著自動調整,在Android中
em代表‘M’的數量。但是
EditText的屬性,只有在
android:layout_width=“wrap_content”時,才會顯示;如果是
android:layout_width=“match_parent”時,則不會有變化。
em參考: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.”
ems屬性參考:參考:http://stackoverflow.com/questions/7053738/what-is-meant-by-ems-android-textviewandroid: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.