本文介绍了TextInputLayout& TextInputEditText提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

这是我的xml代码,用于为用户电话号码输入文本但是当它未聚焦时,提示标签将以较大的文本大小显示我的问题是,即使字段中没有文本,如何使提示标签也像密码一样被激活.

This is my xml code to make a input text for user phone numberbut when it unfocused the hint label showed with larger text sizemy question is how to make the hint label activated like password even when there is no text in the field.

<android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColorHint="@color/colorText">

            <android.support.design.widget.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/phone_number"
                android:inputType="number"
                android:maxLines="1"
                android:textColorHint="@color/colorText" />

        </android.support.design.widget.TextInputLayout>

推荐答案

您的提示放置在错误的位置

Your hint is in the wrong place

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="@string/phone_number"
    android:textColorHint="@color/colorText">

    <android.support.design.widget.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:maxLines="1"
        android:textColorHint="@color/colorText" />

</android.support.design.widget.TextInputLayout>

这篇关于TextInputLayout&amp; TextInputEditText提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 19:25