を求めることができ、あなたのコードに応じて をこの次のコードを使用することができます私は文字通り2日前にこの問題を抱えていました。私は両方とも日付ピッカーのポップアップを作成しても、メッセージを表示し、するために、(フォーカスを持っていることを確認しする方法を発見した私はこのようなTextInputLayout
にEditText
をラップしているやってしまった何を:。
<android.support.design.widget.TextInputLayout
android:id="@+id/birthDateInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_birth_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/birth_date_hint"
android:inputType="date" />
</android.support.design.widget.TextInputLayout>
、代わりにエディットテキストにエラーを設定するので、その後、私の代わりにこのようTextInputLayout
にエラーを設定します。
は
birthDateInputLayout.setErrorEnabled(true);
birthDateInputLayout.setError("This field cannot be empty.");
注:はを設定する通常の方法とまったく同じに見えていませんのエラーしかし、それは十分によく見えるし、少し異なって問題を解決します。ここで
は、それがどのように見えるかのスクリーンショットです:
使用のカスタムレイアウトを支援を期待し、同じ –