2017-05-07 7 views
0

"test_layout.xml"에 "android.support.constraint.ConstraintLayout"을 사용합니다. 여기Android. ConstraintLayout : 충분하게 배치하지만 수직으로 스크롤하십시오. 왜?

내 코드 :

여기
<?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:background="#aabbcc"> 

    <TextView 
     android:id="@+id/textView" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:background="#000000" 
     android:gravity="center" 
     android:text="Test text Test text Test text Test text Test text " 
     android:textColor="@android:color/white" 
     android:textSize="24sp" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintHorizontal_bias="0.0" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toTopOf="parent" 
     app:layout_constraintVertical_bias="0.18" /> 

    <ImageView 
     android:id="@+id/imageView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="8dp" 
     android:layout_marginRight="8dp" 
     android:layout_marginTop="8dp" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toBottomOf="@+id/textView" 
     app:layout_constraintVertical_bias="0.0" 
     app:srcCompat="@drawable/input_checkmark_on_green" /> 

    <TextView 
     android:id="@+id/textView8" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:background="#ff0000" 
     android:gravity="center" 
     android:text="Test text Test text Test text Test text Test text Test text Test text Test text Test text Test text Test text Z" 
     android:textColor="@android:color/white" 
     android:textSize="18sp" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toBottomOf="@+id/imageView" 
     app:layout_constraintVertical_bias="0.0" /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:background="#000000" 
     android:gravity="center" 
     android:text="Test text Test text Test text Test text Test text Test text Test text Test text Test text Test text Test text Z" 
     android:textColor="@android:color/white" 
     android:textSize="18sp" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toBottomOf="@+id/textView8" 
     app:layout_constraintVertical_bias="0.0" /> 

    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:background="#ff0000" 
     android:gravity="center" 
     android:text="Test text Test text Test text Test text Test text Test text Test text Test text Test text Test text Test text Z" 
     android:textColor="@android:color/white" 
     android:textSize="18sp" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toBottomOf="@+id/textView2" 
     app:layout_constraintVertical_bias="0.0" /> 

결과 (스크린 샷 # 1) : 충분한 장소를 볼 수 있지만이 veritically 스크롤 할

Before scroll vertically

.

페이지의 스크린 샷 # 2 :

After scroll vertically

왜 스크롤 수직인가? 충분한 장소가있을 때 수직으로 스크롤하고 싶지 않습니다. 내가 어떻게 할 수 있니?

답변

0

해결책을 찾았습니다.

은 교체 :

이 :

app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent"

항목 아래의 모든 항목에 대한

app:layout_constraintLeft_toLeftOf="@+id/textView" 
app:layout_constraintRight_toRightOf="@+id/textView" 

에 의해. "안드로이드 : ID ="@ + ID/텍스트 뷰 "결과 -

그러나이 설정이 VE에 영향을 미치는 이유는 무엇입니까? 수갑 스크롤?