android / codelab-constraint-layout

Constraint Layout Codelab
https://codelabs.developers.google.com/codelabs/constraint-layout/
Apache License 2.0
469 stars 243 forks source link

2.0.0-beta4 - Inconsistent paddingStart/paddingEnd behaviour in RTL #85

Open cjami opened 4 years ago

cjami commented 4 years ago

Given a simple constraint layout with padding:

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingStart="10dp">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="THIS IS A TEST"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

In Left-To-Right, the layout behaves as expected:

Screenshot 2020-05-07 at 11 50 54

However in Right-To-Left, the layout handles paddingStart differently and clips the view:

Screenshot 2020-05-07 at 11 50 40

The same thing occurs with paddingEnd given a parent end constraint.

It is expected that padding behaviour would be consistent between LTR and RTL versions of the layout.