When using maxLines="1"
in combination with gravity="center"
and ellipsize="end"
, the text gets clipped from the beginning.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
style="@style/TextAppearance.MaterialComponents.Body1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s" />
</LinearLayout>
The issue gets resolved if maxLines="1"
is changed to singleLine="true"
, but it's a deprecated attribute.