2016-03-03 144 views

回答

0

我不认为你可以使用默认弹出改变的背景下,你就必须创建自己的弹出窗口。

但更好的解决方案可能是使用TextInputLayout来包装您的EditText,然后在TextInputLayout上设置错误。

<android.support.design.widget.TextInputLayout 
    android:id="@+id/textInputLayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <EditText 
     android:id="@+id/edittext" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Hint"/> 

</android.support.design.widget.TextInputLayout> 

然后使用

mTextInputLayout.setError("your error string");