我试着用这些台词来做些什么:

我可以使用android:hint="Email Address"显示提示,但不能显示辅助文本-这将是您的电子邮件用户名。
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/et_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="15"
android:hint="Username"
app:et_helper="Username is preferably your registered email"/>
</android.support.design.widget.TextInputLayout>`我得到的只是,没有用户名,最好是您的注册电子邮件,以下编辑:
输出:

任何指南针都会赏识。谢谢。
发布于 2015-11-24 10:56:06
最好的方法是使用TextInputLayout。谷歌把它引入了新的设计库。为了使用TextInputLayout,必须在build.gradle依赖项中添加以下内容:
compile 'com.android.support:design:22.2.0'然后在xml文件中使用它:
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your name"/>
</android.support.design.widget.TextInputLayout>您可以通过将错误设置为true来设置文本。虽然它是用来显示错误的,但它适合你使用。如果你愿意,你可以改变颜色和字体。
TextInputLayout til = (TextInputLayout) findViewById(R.id.textInputLayout);
til.setErrorEnabled(true);
til.setError("You need to enter a name");

https://stackoverflow.com/questions/33891482
复制相似问题