今天开发时遇到个小问题,view.seterror的文字由于和theme重叠而无法显示,以前就遇到过,不过想换种方法。
有人说在style里面加<item name="android:textColorPrimaryInverse">@android:color/primary_text_light</item>
<style name="AppBaseTheme" parent="@android:style/Theme.Light.NoTitleBar"> <item name="android:textColorPrimaryInverse">@android:color/primary_text_light</item> <!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --> </style>
有人说:
int ecolor = R.color.black; // whatever color you want ForegroundColorSpan fgcspan = new ForegroundColorSpan(ecolor); String estring="用户名不能为空"; SpannableStringBuilder ssbuilder = new SpannableStringBuilder(estring); ssbuilder.setSpan(fgcspan, 0, estring.length(), 0); username.setError(ssbuilder); }
错误记录seterror的文字不显示,布布扣,bubuko.com
原文:http://blog.csdn.net/aimncy/article/details/27504023