I have added an EditText to my layout, but the ellipsize doesn't work. Can anybody help me? Thanks.
<EditText
android:layout_width="match_parent"
android:layout_margin="10dp"
android:singleLine="true"
android:ellipsize="end"
android:textSize="24dp"
android:layout_height="wrap_content" />
Ellipsize="end"
wont work for editable EditText
so you need to make the EditText
as non editable to make it work. Use the following code
<EditText
android:layout_width="match_parent"
android:layout_margin="10dp"
android:textSize="24dp"
android:text="A long texttttttttttttttttttttttttttttttttttttttttttttt"
android:lines="1"
android:scrollHorizontally="true"
android:ellipsize="end"
android:singleLine="true"
android:layout_height="wrap_content"
tools:ignore="Deprecated" />
ellipsize maybe works only with
android:ellipsize="end"
android:singleLine="true"
and sometimes we add one more
android:maxLines="n"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.