// In you layout Xml
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:id="@+id/layFName"
android:textColorHint="@color/edittext_hintcolor"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"
android:layout_height="wrap_content">
<EditText
android:id="@+id/et_name_registration"
android:inputType="textPersonName"
android:hint="Hint Text"
/>
</android.support.design.widget.TextInputLayout>
// In java
private TextInputLayout mLayFName;
mLayFName = (TextInputLayout) findViewById(R.id.layFName);
for set error
mInputLayoutView.setError(msg);
EditText.getBackground().setColorFilter(getResources().getColor(R.color.red), PorterDuff.Mode.SRC_ATOP);}
ここをクリックしてください:http://coderzpassion.com/android-material-design-floating-labels-edittext/ –