EditText 는 입력 숫자 를 제한 하고 소수점 뒤의 1 자리 까지 정확하게 설정 하 는 방법 입 니 다.
1156 단어 edittext제한 하 다.숫자 를 입력 하 다소수점
android:inputType="numberDecimal"
코드 에서:
/** */
private static final int DECIMAL_DIGITS = 1;
InputFilter lengthfilter = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end,
Spanned dest, int dstart, int dend) {
// ,
if ("".equals(source.toString())) {
return null;
}
String dValue = dest.toString();
String[] splitArray = dValue.split("//.");
if (splitArray.length > 1) {
String dotValue = splitArray[1];
int diff = dotValue.length() + 1 - DECIMAL_DIGITS;
if (diff > 0) {
return source.subSequence(start, end - diff);
}
}
return null;
}
};
et_content.setFilters(new InputFilter[] { lengthfilter });
이상 의 이 EditText 는 입력 숫자 를 제한 합 니 다.소수점 뒤의 1 자리 까지 정확하게 설정 하 는 방법 은 바로 편집장 이 여러분 에 게 공유 하 는 모든 내용 입 니 다.참고 하 시기 바 랍 니 다.여러분 들 도 많이 응원 해 주시 기 바 랍 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
ADSL Modem NAT 를 정확하게 설정 하여 네트워크 응용 에 한계 가 없 도록 합 니 다.많은 친구 들 이 인터넷 방송국 의 프로그램 을 듣 는 것 을 좋아 하고,더 많은 친구 들 은 자신 이 DJ 가 되 는 것 을 좋아한다.다음은 필 자 는 DJ 가 되 어 개인 방송국 의 꿈 을 이 루 는 방법 을 알...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.