xml文件中添加android:ellipsize="end"和android:layout_height="wrap_content"这两句话即可解决代码如下:
<TextView android:id="@+id/aa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
/>
如果你用的是EditText,解决方法一样,它有个函数专门解决这个问题,看了API您就恍然大悟了Causes words in the text that are longer than the view is wideto be ellipsized instead of broken in the middle. You may also wantto setSingleLine()
orsetHorizontallyScrolling(boolean)
to constrainthe text to a single line. Use null
to turn offellipsizing.
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。