参考下面的代码:
public class ExpandableTextView extends TextView {
public ExpandableTextView(Context context) {
this(context, null, null);
}
public ExpandableTextView(Context context, AttributeSet attrs) {
this(context, attrs, null);
}
public ExpandableTextView(Context context, AttributeSet attrs, Runnable runnable) {
super(context, attrs);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ExpandableTextView);
this.trimLength = typedArray.getInt(R.styleable.ExpandableTextView_trimLength, DEFAULT_TRIM_LENGTH);
typedArray.recycle();
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
trim = !trim;
setText();
requestFocusFromTouch();
}
});
}
public ExpandableTextView(Context context, AttributeSet attrs, Activity activity) {
super(context, attrs);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ExpandableTextView);
this.trimLength = typedArray.getInt(R.styleable.ExpandableTextView_trimLength, DEFAULT_TRIM_LENGTH);
typedArray.recycle();
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
trim = !trim;
setText();
requestFocusFromTouch();
}
});
}
}
像这样的方法(上下文,空,空);可以引用其他两个构造函数方法,有什么方法可以指定它引用哪一个而不是更改签名或“null”?谢谢