我的問題:
我在看TextWatcher的源代碼,我沒有在這裏得到這個概念。 延伸到NoCopySpan有什麼意義?實現相同接口的接口內的內部類,我們通過這個實現了什麼?
TextWatcher.java:
public interface TextWatcher extends NoCopySpan {
public void beforeTextChanged(CharSequence s, int start, int count, int after);
public void onTextChanged(CharSequence s, int start, int before, int count);
public void afterTextChanged(Editable s);
}
NoCopySpan.java:
package android.text;
/**
* This interface should be added to a span object that should not be copied into a new Spanned when performing a slice or copy operation on the original Spanned it was placed in.
*/
public interface NoCopySpan {
/**
* Convenience equivalent for when you would just want a new Object() for
* a span but want it to be no-copy. Use this instead.
*/
public class Concrete implements NoCopySpan {}
}
我覺得只是一個'''helper'''當你需要應使用類傳遞'''NoCopySpan'''的實例。 – danypata