ViewStub使用场景
在开发项目中经常碰到一些在指定条件下才需要加载的layout,比如网络异常页面.你可以仅在需要的时候载入它们,提高 UI 渲染速度。这时就可以使用ViewStub !!!
ViewStub使用方法
ViewStub 通过设置 android:layout 属性来指定需要被 inflate 的 Layout 类型。
xml中:
<ViewStub
android:id="@+id/vs_loading_abnormity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/loading_hint" />
注意: android:layout_