我有以下代码 View
, 我想在它上面添加一个 TextView
。 有人知道怎么做吗?
public class ProgressView extends View {
TextView text;
public ProgressView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
text = new TextView(getContext());
text.setText("Hello");
// How can I add this to the view now??
}
@Override
protected void onDraw(final Canvas canvas) {
}
}
View
或ViewGroup
会有什么作用? - kalabalik