Android,android官網

來源:互聯網
上載者:User

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.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.