2012-06-11 4 views
0

접근 방법을 찾아야합니다. 제발 도와주세요.Android EditTextView에서 자동 완성 마스크

사용자로부터 가격을 입력해야하는 앱을 개발 중입니다. 거기에 자동 완성 마스크 EditTextView가 필요합니다. 사용자의 소원 100500을 입력하는 경우처럼

는 자동적으로 입력 값으로 대체 문자열이있을 것이다 $ 100,500.00

나는 이것이 내가 필요 실제로 무엇인지 설명하기에 충분하다고 생각합니다. 이것에 대해 제발 제안 해주세요. 고맙습니다.

답변

1

아래와 같이 EditText에 TextWatcher를 추가 할 수 있습니다. onTextChanged 메서드에서 사용자의 현재 입력 (CharSequence)을 분석 및 수정 한 다음 EditText ("yourModifiedText")를 업데이트하려는 경우

EditText text = (EditText) findViewById(R.id.YOUR_ID); 
text.addTextChangedListener(textWatcher); 

private TextWatcher textWatcher = new TextWatcher() { 

    public void afterTextChanged(Editable s) { 
    } 

    public void beforeTextChanged(CharSequence s, int start, intcount, int after) { 
    } 

    public void onTextChanged(CharSequence s, int start, int before, 
      int count) { 

    } 
} 
관련 문제