【发布时间】:2017-04-18 21:46:12
【问题描述】:
这是我的 xml 代码,用于为用户电话号码输入文本 但是当它没有聚焦时,提示标签会以较大的文本大小显示 我的问题是如何使提示标签像密码一样激活,即使字段中没有文本。
<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>
【问题讨论】:
-
你有没有想过使用编辑文本和文本视图来实现你想要的视图而不是 TextInputLayout?我不认为你需要文本输入布局,好的旧的编辑文本和文本视图就足够了。
-
我知道我可以做这个解决方案,但我想使用 TextInputEditText。
标签: android android-layout android-support-library