如何即时修改EditText的内容?

时间:2016-04-30 05:33:35

标签: android

我有TextWatcher,当用户在其中输入文字时,需要在每个字符后进行一定的动态格式化。但是,// This should be called with the newest character // whenever the user gives input public void append(char c) { ... } // This should be called to get the correctly formatted string // whenever it should be shown on the UI public String getResult() { ... } 似乎并不适合这种情况,因为无论何时更改文本,都会以递归方式调用它:

  

从这个回调中对s进行进一步的更改是合法的,但要注意不要陷入无限循环,因为你所做的任何更改都会导致再次以递归方式调用此方法。

我写的格式化程序会跟踪整个字符串并逐个应用字符,即时格式化文本。 formatter的API是这样的:

EditText

所以,问题是:如何将格式化程序挂钩到<?php $date = isset($_GET['date']) ? $_GET['date'] : date('Y-m-d'); $prev_date = date('Y-m-d', strtotime($date .' -1 day')); echo $prev_date; ?>

0 个答案:

没有答案
相关问题