I added
android:ellipsize="end"
android:maxEms="8"
android:singleLine="true"
to my TextView
with the intention of showing three dots at the end and max text limit of 8 but it's not working. It shows neither the dots nor any text limit.
Android Ellipsize Android TextView ellipsize property Causes words in the text that are longer than the view's width to be ellipsized ( means to shorten text using an ellipsis, i.e. three dots …) instead of broken in the middle to fit it inside the given view.
If you want a horizontal scrollable text in your app, use android:ellipsize="marquee" where a single line large text will be scrolling.
ems is a unit of measurement. The name em was originally a reference to the width of the capital M. It sets the width of a TextView/EditText to fit a text of n 'M' letters regardless of the actual text extension and text size. Eg : android:ems Makes the EditText be exactly this many ems wide.
For some reason, I accidentally had put
android:inputType="textCapSentences"
on my TextView which prevented my ellipses from showing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With