1

ConstraintLayout을 처음 사용했습니다. 부모와 일치하도록 TextInputLayout 너비를 설정하려고했지만 항상 365dp로 이동합니다. 그리고 TextInputLayout을 다른 레이어의 아래쪽에 정렬 할 수 없습니다. 이 문제를 도와주세요. ScreenshotConstraintLayout에서 TextInputLayout이 제대로 작동하지 않습니다.

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayoutxmlns: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="dcastalia.com.cook4me.LoginActivity" 
tools:layout_editor_absoluteY="81dp" 
tools:layout_editor_absoluteX="0dp"> 


<android.support.design.widget.TextInputLayout 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    app:layout_constraintTop_toTopOf="parent" 
    android:layout_marginTop="39dp" 
    android:layout_marginLeft="32dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginRight="32dp" 
    app:layout_constraintRight_toRightOf="parent" 
    android:layout_marginStart="32dp" 
    android:layout_marginEnd="32dp" 
    app:layout_constraintHorizontal_bias="0.0" 
    android:id="@+id/textInputLayout"> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="hint" /> 
</android.support.design.widget.TextInputLayout> 

<android.support.design.widget.TextInputLayout 
    android:layout_width="395dp" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/textInputLayout" 
    app:layout_constraintRight_toRightOf="@+id/textInputLayout"> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="hint" /> 
</android.support.design.widget.TextInputLayout> 

+0

사르 카르가 해결책을 찾았습니까? – Nilabja

답변

0

는 TextInputLayout 폭 match_parent를 원하는 경우에이

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    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:layout_editor_absoluteX="0dp" 
    tools:layout_editor_absoluteY="81dp" 
    android:id="@+id/constraint"> 


    <android.support.design.widget.TextInputLayout 
     android:id="@+id/textInputLayout1" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_marginEnd="32dp" 
     android:layout_marginLeft="32dp" 
     android:layout_marginRight="32dp" 
     android:layout_marginStart="32dp" 
     android:layout_marginTop="32dp" 
     app:layout_constraintHorizontal_bias="0.0" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toTopOf="parent"> 

     <EditText 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="hint" /> 
    </android.support.design.widget.TextInputLayout> 

    <android.support.design.widget.TextInputLayout 
     android:id="@+id/textInputLayout2" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="8dp" 
     app:layout_constraintTop_toBottomOf="@+id/textInputLayout1" 
     app:layout_constraintLeft_toLeftOf="@+id/textInputLayout1" 
     app:layout_constraintRight_toRightOf="@+id/textInputLayout1"> 

     <EditText 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="hint" /> 
    </android.support.design.widget.TextInputLayout> 
</android.support.constraint.ConstraintLayout> 
0

, 당신은

<android.support.design.widget.TextInputLayout 
    android:id="@+id/textInputLayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    > 
    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="hint" 
     /> 
</android.support.design.widget.TextInputLayout> 
모든 marginStart 및 marginEnd (또는 marginLeft 및 marginRight)를 android:layout_width="match_parent"를 설정하고 제거해야 시도