2016-09-15 72 views
0

我想用TextWatcher(textChangelistener)爲TextView android系統中我做了,有一個研究中,我才知道,有可能有OnTextChangeListenerEditText。但我的TextView將根據其他EditText的變化自動更改。所以我想有一個OnTextChangedListener進行進一步計算..是Textwatcher僅用於Android的EDITTEXT

任何人都可以幫助我做到這一點!!!!!由於提前

+0

是的,你可以在他們已經使用了的EditText – Anjali

+0

究竟什麼是你問同樣的方式使用textwatcher您的TextView呢?我認爲你的問題還不清楚,你應該編輯和重述它。 – Diti

+0

'addTextChangedListener()'是'TextView'的一種方法。 – earthw0rmjim

回答

0

據我理解你的問題EditText's文本由用戶動態改變,所以我們需要爲TextWatcherEditText,但在TextView任何文本正在被改變的情況下將僅開發商改變。因此,無論何時將文本設置爲TextView,都應對其執行操作。如果你想使用它,如下所示。

textView.addTextChangedListener(new TextWatcher() { 

    boolean editing=false; 

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

    } 

    @Override 
    public void beforeTextChanged(CharSequence s, int start, int count,int after) { 

    } 

    @Override 
    public void afterTextChanged(Editable s) { 
     if (!editing){ 
      editing=true; 
      s.append("A"); 
      editing=false; 
    } 


    } 
}); 
相關問題