Saturday, 26 August 2017

What is meant by Ems? (Android TextView)



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.


Answer



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.



No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...