android:ems = "10" 的含义 :
指的是将对应的控件宽度设为10个字符的宽度。当设置该属性后,一行中最大只能显示设置的宽度。
-
<TextView
-
android:ems="1"
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:text="Hello world"/>
当设置 ems = "1" 时,显示如下 (EditText 同理):
注意,当 android:layout_width="match_parent" 时该属性不会生效