2
這裏是我的XML的EditText與「文」的inputType沒有隱瞞錯誤彈出時,文本更改
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/barcode"
android:id="@+id/barcode"
android:inputType="number" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/name"
android:id="@+id/name"
android:inputType="text" />
我設置錯誤這兩個領域:
((TextView) findViewById(R.id.barcode)).setError(getString(R.string.at_least_one_field));
((TextView) findViewById(R.id.name)).setError(getString(R.string.at_least_one_field));
當我運行應用程序並更改內容在barcode
字段中出現錯誤彈出窗口。 而當我在name
字段中更改內容時,彈出式窗口不會隱藏。只有當我點擊鍵盤上的完成按鈕時纔會隱藏。
爲什麼number
和text
字段有不同的行爲?
在'barcode'發現了一個解釋,或者它消失在你開始輸入後,你點擊後在第二個TextView中? – 2014-09-20 15:25:20
@KubaSpatny當我開始輸入時它就消失了。 – Turako 2014-09-21 12:04:21