我是新來的android編程。我遇到一個問題,我在應用此主題中給出的解決方案很難: How to format the input of EditText when typing with thousands separators (,) in Android?我應該如何將TextChangedListener添加到EditText組件?
到目前爲止,我還做了一個單獨的Java文件和粘貼文本的主要代碼,但我不能找出如何「添加editText.addTextChangedListener(new NumberTextWatcher(editText));我的EditText組件」。 我的XML EditText上看起來是這樣的:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:id="@+id/editText"
android:layout_weight="1"
/>