3

Weiß jemand, warum ConstraintLayout bei der Umstellung auf rtl alle Elemente zentriert?Wie kann ConstraintLayout für RTL richtig funktionieren?

android:supportsRtl="true" in Manifest festgelegt ist.

BookShelfActivity.java enthält nur Standard onCreate Überschreibung:

public class BookShelfActivity extends AppCompatActivity { 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_book_shelf); 
    } 
} 

Hier ist die Aktivität xml:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
    android:id="@+id/activity_book_shelf" 
    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="com.hekayh.ereader.BookShelfActivity" 
    android:layout_gravity="start" 
    > 

    <TextView 
     android:text="TextView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/textView5" 
     /> 

    <TextView 
     android:text="AnotherTextView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="start" 
     android:id="@+id/textView6" 
     app:layout_constraintEnd_toEndOf="@id/textView5" 
     tools:layout_editor_absoluteX="277dp" 
     app:layout_constraintTop_toTopOf="@+id/activity_book_shelf" 
     android:layout_marginTop="42dp"/> 

    <Button 
     android:text="Button" 
     android:layout_width="91dp" 
     android:layout_height="51dp" 
     android:id="@+id/button2" 
     app:layout_constraintStart_toStartOf="@+id/activity_book_shelf" 
     android:layout_marginStart="100dp" 
     app:layout_constraintTop_toBottomOf="@+id/textView6" 
     android:layout_marginTop="24dp" 
     /> 
</android.support.constraint.ConstraintLayout> 

enter image description here

+0

ich es ist ein Fehler zu glauben. – zoltish

+0

Ja, es ist definitiv ein Fehler, aber möglicherweise jemand versucht, es mit Quellcode von Constraint Layout zu beheben .. * - * – vlozful

+1

Gefunden, dass die neuesten com.android.support.constraint: constraint-Layout: 1.0.0-Alpha6 scheint davon frei sein. – vlozful

Antwort

Verwandte Themen