在 Android 12 上,使用长文件名可重现问题。正如它在所附图像中看到的那样,文件的扩展名是纵向切割的。
问题是:当一行显示一个文件名,且需要android:ellipsize="middle"时,setsetting "android:textAppearance="?attr/textAppearanceSubtitle1" 时文件名后缀显示不完整
和布局
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FirstFragment">
<TextView
android:id="@+id/first_line_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:ellipsize="middle"
android:maxLines="1"
app:layout_constraintWidth="true"
android:text="RF_20210819NZ Herald - Breaking news, latest news, business, sport and entertainment - NZ Herald.url"
android:textAppearance="?attr/textAppearanceSubtitle1"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="RF_20210819NZ Herald - Breaking news, latest news, business, sport and entertainment - NZ Herald.url" />
<Button
android:id="@+id/button_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/next"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/first_line_text" />
</androidx.constraintlayout.widget.ConstraintLayout>