(1) LayoutInflater inflater = LayoutInflater.from(getContext());
View itemView = inflater.inflate(R.layout.agenda_item, this);
(2) LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = inflater.inflate(R.layout.agenda_item, this);
当你为一个 activty 添加一个可见的 view, 并且运行这个activty时,android通常情况下会自动按照下列顺序来触发view的相关事件
onAttachedToWindowonMeasure
onSizeChanged
onLayout
onDraw