在我的列表视图中,有些行没有rtl对齐。
滚动和重新绘制后,行是正确的。
我的行项目布局:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/clFrontView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:paddingTop="10dp"
    android:paddingBottom="10dp"
    android:paddingLeft="16dp"
    android:paddingRight="16dp">

    <ImageView
        android:id="@+id/ivCircle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/circle"
        tools:ignore="ContentDescription"
        android:layout_marginTop="5dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintLeft_toLeftOf="parent" />

    <ImageView
        android:id="@+id/ivReminderType"
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        tools:ignore="ContentDescription"
        app:layout_constraintTop_toTopOf="@id/ivCircle"
        app:layout_constraintBottom_toBottomOf="@id/ivCircle"
        app:layout_constraintStart_toStartOf="@id/ivCircle"
        app:layout_constraintEnd_toEndOf="@id/ivCircle"
        app:layout_constraintLeft_toLeftOf="@id/ivCircle"
        app:layout_constraintRight_toRightOf="@id/ivCircle" />

    <de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/civContactImage"
        android:layout_width="42dp"
        android:layout_height="42dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintStart_toStartOf="parent"/>

    <ImageView
        android:id="@+id/icivCircleSmall"
        android:layout_width="15dp"
        android:layout_height="15dp"
        app:layout_constraintEnd_toEndOf="@id/civContactImage"
        app:layout_constraintRight_toRightOf="@id/civContactImage"
        app:layout_constraintBottom_toBottomOf="@id/civContactImage"
        tools:ignore="ContentDescription"/>

    <TextView
        android:id="@+id/tvTextLine"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        tools:text="Line of Text"
        android:textSize="18sp"
        android:maxLines="2"
        app:layout_constraintLeft_toRightOf="@id/ivCircle"
        app:layout_constraintStart_toEndOf="@id/ivCircle"
        android:layout_marginLeft="16dp"
        android:layout_marginStart="16dp"/>

    <TextView
        android:id="@+id/tvTextLine2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:textSize="16sp"
        android:visibility="gone"
        app:layout_constraintStart_toStartOf="@id/tvTextLine"
        app:layout_constraintLeft_toLeftOf="@id/tvTextLine"
        app:layout_constraintTop_toBottomOf="@id/tvTextLine" />

    <TextView
        android:id="@+id/tvTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        tools:text="Wed, 01.05.2018 10:10"
        android:textColor="#FF909090"
        android:textSize="12sp"
        android:drawablePadding="5dp"
        app:layout_constraintStart_toStartOf="@id/tvTextLine"
        app:layout_constraintLeft_toLeftOf="@id/tvTextLine"
        app:layout_constraintTop_toBottomOf="@id/tvTextLine2" />

    <TextView
        android:id="@+id/tvRepeat"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        tools:text="Every 2nd Friday"
        android:textColor="#FF909090"
        android:textSize="12sp"
        android:drawablePadding="5dp"
        app:layout_constraintStart_toStartOf="@id/tvTextLine"
        app:layout_constraintLeft_toLeftOf="@id/tvTextLine"
        app:layout_constraintTop_toBottomOf="@id/tvTime" />

</android.support.constraint.ConstraintLayout>

首先,它看起来像这样,第一行不是rtl:
android - ConstraintLayout ListView RTL有些行不是RTL-LMLPHP
向下再向上滚动到顶部后,它是正确的:
android - ConstraintLayout ListView RTL有些行不是RTL-LMLPHP
build.gradle依赖项:
implementation 'com.android.support.constraint:constraint-layout:1.1.2'

最佳答案

这些更改可能有效:

<ImageView
    android:id="@+id/ivCircle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/bg_circle_win"
    app:layout_constraintBottom_toBottomOf="@+id/civContactImage"
    app:layout_constraintStart_toStartOf="@+id/civContactImage"
    tools:ignore="ContentDescription" />

<ImageView
    android:id="@+id/ivReminderType"
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    app:layout_constraintEnd_toEndOf="@+id/civContactImage"
    app:layout_constraintTop_toTopOf="@+id/civContactImage"
    tools:ignore="ContentDescription" />

<de.hdodenhof.circleimageview.CircleImageView
    android:id="@+id/civContactImage"
    android:layout_width="42dp"
    android:layout_height="42dp"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginTop="8dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<ImageView
    android:id="@+id/icivCircleSmall"
    android:layout_width="15dp"
    android:layout_height="15dp"
    app:layout_constraintEnd_toEndOf="@id/civContactImage"
    app:layout_constraintRight_toRightOf="@id/civContactImage"
    app:layout_constraintBottom_toBottomOf="@id/civContactImage"
    tools:ignore="ContentDescription"/>

<TextView
    android:id="@+id/tvTextLine"
    android:layout_width="wrap_content"
    android:layout_height="23dp"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:gravity="center_vertical"
    android:maxLines="2"
    android:textSize="18sp"
    app:layout_constraintEnd_toStartOf="@+id/civContactImage"
    tools:text="Line of Text" />

<TextView
    android:id="@+id/tvTextLine2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:textSize="16sp"
    android:visibility="gone" />

<TextView
    android:id="@+id/tvTime"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:drawablePadding="5dp"
    android:gravity="center_vertical"
    android:textColor="#FF909090"
    android:textSize="12sp"
    app:layout_constraintEnd_toStartOf="@+id/civContactImage"
    app:layout_constraintTop_toBottomOf="@+id/tvTextLine"
    tools:text="Wed, 01.05.2018 10:10" />

<TextView
    android:id="@+id/tvRepeat"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:drawablePadding="5dp"
    android:gravity="center_vertical"
    android:textColor="#FF909090"
    android:textSize="12sp"
    app:layout_constraintEnd_toStartOf="@+id/civContactImage"
    app:layout_constraintTop_toBottomOf="@+id/tvTime"
    tools:text="Every 2nd Friday" />

我希望能工作。祝你好运

10-02 02:55