接口内部的类实现了相同的接口,我们通过这种方式实现了什么?我的问题:文本观察者.java:无复制跨度.java:
2022-09-01 23:49:00
我的问题:
我正在查看TextWatcher的源代码,但我在这里没有得到这个概念。扩展到NoCopySpan有什么意义?
文本观察者.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);
}
无复制跨度.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 {}
}