I Have the LinearLayout with two nested TextInputLayout.
When there is no error, then everything is OK. But when an error occurs, the size of the TextInputLayout changes. Tell me please, what am I doing wrong.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="40dp"
android:baselineAligned="false"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputPower"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:orientation="horizontal">
<EditText
android:id="@+id/editText3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits=".0123456789"
android:hint="Мощность (W)"
android:inputType="numberDecimal"
android:maxLength="10"
android:textColor="@color/text_color_nav"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputAmperage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_weight="1">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits=".0123456789"
android:hint="Ток (А)"
android:inputType="numberDecimal"
android:maxLength="10"
android:textColor="@color/text_color_nav"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
Use weight sum for linear layout.
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="40dp"
android:baselineAligned="false"
android:weightSum="2"
android:orientation="horizontal"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputPower"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:orientation="horizontal">
<EditText
android:id="@+id/editText3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits=".0123456789"
android:hint="Мощность (W)"
android:inputType="numberDecimal"
android:maxLength="10"
android:textColor="@color/text_color_nav"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputAmperage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_weight="1">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits=".0123456789"
android:hint="Ток (А)"
android:inputType="numberDecimal"
android:maxLength="10"
android:textColor="@color/text_color_nav"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>