많은 시도를 해본 결과 R & D를 보았지만 EditText에서 자신 만의 오류 드로어 블을 보여줄 수 없었습니다.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