3

누군가가 왜 rtl로 전환 할 때 ConstraintLayout이 모든 요소를 ​​중앙에 배치하는지 알고 있습니까?ConstraintLayout을 RTL 용으로 올바르게 작성하는 방법은 무엇입니까?

android:supportsRtl="true" in manifest가 설정됩니다.

<?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

나는 그것의 버그 믿는다. – zoltish

+0

예, 분명히 버그 일뿐입니다 만, Constraint Layout의 소스 코드를 사용해 그것을 고치려고했을 가능성이 있습니다. * - * – vlozful

+1

최신의 com.android.support.constraint : constraint-layout : 1.0.0-alpha6가 발견되었습니다 이것으로부터 자유 롭다. – vlozful

답변

2

그것은 알파 6 에 해결하기 전에 내가보고 된 버그입니다 : 여기

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

가 활동 XML입니다 :

BookShelfActivity.java은 표준에서 onCreate 재정의를 포함 https://code.google.com/p/android/issues/detail?id=218979

하지만 난 여기에 코멘트 https://code.google.com/p/android/issues/detail?id=220103

업데이트하여 지원해야 RTL에 대한 또 다른 버그가 : 개발자가 두 번째 RTL 버그가 해결 언급 : https://code.google.com/p/android/issues/detail?id=222556

관련 문제