android:ems 属性

android:ems = "10" 的含义 : 

指的是将对应的控件宽度设为10个字符的宽度。当设置该属性后,一行中最大只能显示设置的宽度。

  1. <TextView

  2. android:ems="1"

  3. android:layout_width="wrap_content"

  4. android:layout_height="wrap_content"

  5. android:text="Hello world"/>

当设置 ems = "1" 时,显示如下 (EditText 同理): 

注意,当 android:layout_width="match_parent" 时该属性不会生效

猜你喜欢

转载自blog.csdn.net/mid_Faker/article/details/108568729