码迷,mamicode.com
首页 > 移动开发 > 详细

Android - 控件android:ems属性

时间:2014-12-02 22:37:26      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:mystra   android   ems   属性   xml   

控件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参考:
“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属性参考:
android: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.

Android - 控件android:ems属性

标签:mystra   android   ems   属性   xml   

原文地址:http://blog.csdn.net/caroline_wendy/article/details/41684255

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!