2016-03-03 142 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");