Android 常用布局

1.线性布局(LinearLayout)

使用线性布局,首先在xml文件中修改布局为LinearLayout

修改完成后,可在Component Tree中看见如下内容:

点击LinearLayout,可在右侧的Attributes中进一步设置是水平放置或者垂直放置

 

注意:每个控件的大小其实还是需要设置的,即需要设置布局高度(layout_width)和布局宽度(layout_height),默认采用match_parent

对齐方式设置:即可以在xml文件中输入

android:gravity="center"

猜你喜欢

转载自www.cnblogs.com/luckyplj/p/10462365.html