Android——UI布局策略

以该图为例

 

 

 

 

UI策略:外层无脑线型垂直布局,行宽占满父类,高随内容变化。内容逐行分析。

    <LinearLayout 

            android:orientation="vertical"

            android:layout_width="match_parent"

            android:layout_width="wrap_content">

 

    </LinearLayout>

 

上图第三行和第六行比较典型。

使用线型水平布局,行宽占满父类,高度随内容变化。子项要么同时宽度使用warp_conent,要么使用weight="1".

上图第三行子项宽度使用 wrap_content , 上图第六行子项宽度使用 weight="1"

 

 

总结

  外层无脑线型垂直布局,行宽无脑match_parent,内容逐行分析。水平排布使用wrap_content或weight="1"

     

 

posted @ 2021-09-04 21:22  remix_alone  阅读(49)  评论(0)    收藏  举报