我的问题是TextInputEditText
视图不会像我期望的那样扩展以占据父级的整个宽度android:layout_width="match_parent"
。下面的代码是应用程序的一个片段:
<?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:id="@+id/constraintLayout">
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/textInputLayout1"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
android:layout_marginLeft="16dp"
app:layout_constraintRight_toLeftOf="@+id/guideline3"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textInputEditText1"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/textInputLayout2"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toRightOf="@+id/textInputLayout1"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="@+id/constraintLayout"
android:layout_marginRight="16dp"
app:layout_constraintTop_toTopOf="@+id/textInputLayout1"
app:layout_constraintBottom_toBottomOf="@+id/textInputLayout1">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textInputEditText2"
android:layout_weight="1"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="0dp"/>
</android.support.design.widget.TextInputLayout>
<android.support.constraint.Guideline
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/guideline3"
app:layout_constraintGuide_Percent="51"
android:orientation="vertical"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="216dp"/>
</android.support.constraint.ConstraintLayout>