布局优化之抽象布局--include,merge,viewstub

include重用布局,多用于把标题栏引入
merge 减少布局层级,是对include的进一步优化
viewstub view延迟加载,在需要的时候再去加载它;例如进度条可设为viewstub布局,有个缺陷是不支持merge标签,用法:把进度条用layout引入即可。

    <ViewStub  
        android:id="@+id/stub_import"  
        android:inflatedId="@+id/panel_import"  
        android:layout="@layout/progress_overlay"  
        android:layout_width="fill_parent"  
        android:layout_height="wrap_content"  
        android:layout_gravity="bottom" />  

https://blog.csdn.net/xyz_lmn/article/details/14524567

猜你喜欢

转载自blog.csdn.net/xiyangyang8110/article/details/80355614