私は多くを試み、R & Dをしましたが、EditTextの下で独自のカスタムエラーdrawableを表示することができませんでした。ここでEditTextの下にテキストのポップアップ
は私のコードです:
String str = "Please enter a valid email address”;
// This line is used to give color to error text.
ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.YELLOW);
// This line is used to give background color to error text.
BackgroundColorSpan backColorSpan = new BackgroundColorSpan(Color.BLUE);
// This s basically a StringBuilder that implements CharSequence interface.
SpannableStringBuilder strBuilder = new SpannableStringBuilder(str);
strBuilder.setSpan(colorSpan, 0, str.length(), 0);
EditText et = (EditText)findViewById(R.id.et);
Drawable drawable = getResources().getDrawable(R.drawable.btn);
// This line shows our own icon in place of default icon.
setError(CharSequence, Drawable);
So, strBuilder in next line is an implementation of CharSequence.
et.setError(strBuilder, drawable);
任意のソリューション?
達成したいコードと画像を投稿できますか? – Mussa