延迟加载其他视图
创建viewstub
<ViewStub android:id="@+id/viewStub" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout="@layout/two" />
调用
ViewStub viewStub = findViewById(R.id.viewStub);
View inflatedView = viewStub.inflate(); TextView textView = inflatedView.findViewById(R.id.textView); textView.setText("Hello, ViewStub!");