1
更新: 我試圖在EditText上設置android:cursorVisible="false"
,這使白框消失,但也取得了閃爍的光標&綠色圓圈消失過,但我想那些保持可見。的Android的EditText怪異浮動光標下的白盒
在我的光標下有這個奇怪的白色方框。每當我點擊這個字段時,大的綠色圓圈(在光標下,閃爍的東西)和它下面的白色框一起出現。幾秒鐘後,大綠色圓圈和白色方塊都消失了。我如何擺脫那個白色盒子?我不認爲我在styles.xml中有什麼改變的東西,除了主要和重音顏色?
<EditText
android:id="@+id/altPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/alt_phone_hint"
android:singleLine="true"
android:inputType="phone"
android:nextFocusDown="@+id/email"/>
mAltPhoneField.setText(person.getPhoneAlternate());
InputFilter[] phoneFilterArray = new InputFilter[2];
phoneFilterArray[0] = TextUtilities.getPhoneFilter();
phoneFilterArray[1] = new InputFilter.LengthFilter(14);
mAltPhoneField.setFilters(phoneFilterArray);
mAltPhoneField.addTextChangedListener(new PhoneNumberFormattingTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
super.afterTextChanged(s);
mObj.getPerson().modifyPhoneAlternate(s.toString());
}
});
mAltPhoneField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
hasValidAltPhone();
}
}
});
private boolean hasValidAltPhone() {
return hasValidPhoneNumber(mAltPhoneField);
}
private boolean hasValidPhoneNumber(EditText field) {
boolean isValidPhone = true;
if (!TextUtils.isEmpty(field.getText())) {
isValidPhone = TextUtilities.isValidPhoneNumber(field.getText().toString());
if (!isValidPhone) {
field.setError(getString(R.string.invalid_phone_error));
}
}
return isValidPhone;
}
它的位置選擇,我相信,請http://stackoverflow.com/questions/11170409/how-to-disable-cursor-positioning-and-text-selection-in-an-edittext-android – surya
我試着在EditText上設置'android:cursorVisible =「false」',它使得白框消失,但也使閃爍的光標和綠色圓圈也消失了,但我希望那些保持可見。 –
也許您必須爲edittext設置自定義資源 – surya