2011-09-25 5 views
26

숫자 키보드를 가져 오려면 EditText 인 Android가 있습니다.안드로이드 구성 EditText로 소수와 네거티브를 허용합니다.

android : inputType을 numberSigned로 설정하면 숫자 키보드와 음수를 입력 할 수 있습니다. 그러나 이것은 내가 십진법을 사용하게하지 않을 것이다. numberDecimal inputType을 사용하면 십진수를 사용할 수 있지만 네거티브는 사용할 수 없습니다.

어떻게 십진수와 네거티브를 입력 할 수있는 숫자 키보드를 얻으십니까? 당신은 당신의 글고이 누락

답변

67

,

android:inputType="numberDecimal|numberSigned" 
+1

오 와우 정말 간단했습니다. 고마워요! – Rabbit

4

이 링크가 당신에게 http://developer.android.com/resources/articles/creating-input-method.html

도움 그리고 안드로이드에 사용할 수있는 값이 될 수 있습니다 참조 : inputtype은 다음과 같습니다

•none 
•text 
•textCapCharacters 
•textCapWords 
•textCapSentences 
•textAutoCorrect 
•textAutoComplete 
•textMultiLine 
•textImeMultiLine 
•textNoSuggestions 
•textUri 
•textEmailAddress 
•textEmailSubject 
•textShortMessage 
•textLongMessage 
•textPersonName 
•textPostalAddress 
•textPassword 
•textVisiblePassword 
•textWebEditText 
•textFilter 
•textPhonetic 
•textWebEmailAddress 
•textWebPassword 
•number 
•numberSigned 
•numberDecimal 
•numberPassword 
•phone 
•datetime 
•date 
•time 
10

사용할 수 있습니다.

edit_text.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED); 

우리가 프로그래밍 방식으로 사용해야하는 경우 ..

관련 문제