I have an AppCompatTextView
with some RTL text (Persian text, actually), and I set its maxLines
to 1 and ellipsize
value to end
. But it doesn't work properly.
This is my AppComaptTextView
:
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/aditem_category"
android:layout_width="0dp"
android:layout_height="18dp"
android:ellipsize="end"
android:gravity="right|center_vertical"
android:layoutDirection="ltr"
android:lines="1"
android:maxLines="1"
android:text="تست متن طولانی در نرمافزار اندروید که متن عمداً طولانی شده است"
android:textAlignment="gravity"
android:textDirection="rtl"
app:autoSizeMaxTextSize="14sp"
app:autoSizeMinTextSize="12sp"
app:autoSizeStepGranularity="1px"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="@id/image"
app:layout_constraintEnd_toStartOf="@id/iconCategory"
app:layout_constraintStart_toStartOf="parent"
... Other properties ... />
Please read the properties well. I typed those properties which were important to know. But what I get is:
The problems are:
- The ellipsis is at right (start of an RTL text)
- It has too much spacing, but there is room for some other words
- The whole text is at left, but I set its
gravity
toright|center_vertical
Note: when the text isn't long, none of these problems exist.
What should I do?