我想创建自定义 errorText 的 EditText 意味着全边框。
editeText.setError(" ");
给出带有红色边框的错误消息,这有助于显示它是必需的或验证字段。
我创建了自定义错误消息,其中只有图标不同。
Snipped 用于更改错误消息的图标:-
final Drawable error_indicator;
error_indicator = getResources().getDrawable(R.drawable.error_icon_mdpi);
int left = 0;
int top = 0;
int right = error_indicator.getIntrinsicHeight();
int bottom = error_indicator.getIntrinsicWidth();
error_indicator.setBounds(new Rect(left, top, right, bottom));
addSxName.setError("Enter patient name in here", error_indicator);
这是它的样子。
我在找什么:-
但作为工具提示或其他东西,红色边框有点吸引眼球。
我们可以修改那个errorBox的modify吗?
最佳答案
不可能
替代解决方案
- 不要使用 setError()
- 创建自定义弹出窗口
- 创建您自己的设置错误方法并在那里显示弹出窗口
关于android - EditText 上的自定义错误文本边框 android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21086050/