2017-12-11 14 views
1

내 원래 layout했다 코드를 왜곡 제약 레이아웃에 convertng 않습니다. 나는 아래의 코드에서와 같이 제약 레이아웃을 필요로 전환하면 :이유는 아래 그림과 같이보기

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.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" 
    android:orientation="vertical"> 

<com.udacity.gradle.builditbigger.Camera.AutoFitTextureView 
    android:id="@+id/textureView" 
    android:layout_width="0dp" 
    android:layout_height="0dp" 
    android:layout_marginBottom="8dp" 
    app:layout_constraintBottom_toTopOf="@+id/photo_thumbnail_recyclerview" 
    app:layout_constraintEnd_toEndOf="parent" 
    app:layout_constraintStart_toStartOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    /> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/photo_thumbnail_recyclerview" 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="8dp" 
    app:layout_constraintBottom_toBottomOf="parent" 
    app:layout_constraintEnd_toEndOf="parent" 
    app:layout_constraintStart_toStartOf="parent" 
    /> 

<ImageButton 
    android:id="@+id/switchcamera_imageButton" 
    android:layout_width="75dp" 
    android:layout_height="75dp" 
    android:layout_marginBottom="8dp" 
    android:layout_marginEnd="8dp" 
    android:background="@null" 
    android:scaleType="fitCenter" 
    app:layout_constraintBottom_toBottomOf="@+id/textureView" 
    app:layout_constraintEnd_toEndOf="parent" 
    app:srcCompat="@drawable/ic_switch_camera_white_24px" /> 

<ImageButton 
    android:id="@+id/takepicture_imageButton" 
    android:layout_width="75dp" 
    android:layout_height="75dp" 
    android:layout_marginBottom="8dp" 
    android:background="@null" 
    android:scaleType="fitCenter" 
    app:layout_constraintBottom_toBottomOf="@+id/textureView" 
    app:layout_constraintEnd_toEndOf="parent" 
    app:layout_constraintHorizontal_bias="0.5" 
    app:layout_constraintStart_toStartOf="parent" 
    app:srcCompat="@drawable/ic_camera_white_24px" /> 

</android.support.constraint.ConstraintLayout> 

텍스처 view 단지 내가 원하는 것입니다 부모 fragment의 폭을 차지합니다. 그러나 높이는 textureView 하단에있는 imagebuttons 높이보다 높지 않습니다. 또한 recyclerview은 더 이상 표시되지 않습니다. 왜 모든 것에 대해 가설을 가지고 있습니까?

답변

0

내가 원하는 레이아웃을 얻으려면 나는 constraintlayout에서 relativelayout으로 바 꾸었습니다.