2014-01-31 25 views

回答

0

試試這個裏面按鈕單擊事件

editTextName.setError("name cannot be blank"); 
0

最簡單的方法是使用yourEditText.setError("error.."),但要注意有一個bug in this for 4.2

如果你想具體的設計,你可以添加TextView低於您的EditText,並確保您的TextViewvisibility is set to View.GONE。在運行驗證方法時,如果分別出現錯誤,則只需將視圖設置爲View.VISIBLE即可。 Android將處理迴流佈局。

相關問題