我的EditText在TextInputLayout
范围内。
我想要实现的是EditText
完全在TextInputLayout
内,以摆脱编辑字段顶部的空白区域。
这是布局:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/login_edit_style"
android:hint=" "> <!--android:hint=" "> if (TextUtils.isEmpty(mHint)) evaluates to false, and the EditText retains its hint.-->
<EditText
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:drawableLeft="@drawable/ic_person"
android:fontFamily="@font/montserrat"
android:hint="Email"
android:inputType="textEmailAddress"
android:lineSpacingMultiplier="1.17"
android:paddingLeft="@dimen/field_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:textColor="#4A4A4A"
android:textColorHint="@color/colorPrimaryDark"
android:textCursorDrawable="@drawable/cursor_colour"
android:textSize="12sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@drawable/login_edit_style"
android:hint=" "> <!--if (TextUtils.isEmpty(mHint)) evaluates to false, and the EditText retains its hint.-->
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:drawableLeft="@drawable/ic_locker"
android:drawableRight="@drawable/ic_show_pass"
android:ems="10"
android:hint="Password"
android:inputType="textPassword"
android:lineSpacingMultiplier="1.17"
android:paddingLeft="@dimen/field_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:textColor="#4A4A4A"
android:textColorHint="@color/colorPrimaryDark"
android:textCursorDrawable="@drawable/cursor_colour"
android:textSize="12sp" />
</android.support.design.widget.TextInputLayout>