安卓布局常用指令
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_width="match_parent"
match_parent表示让当前控件的大小和父布局的大小一样,也就是由父布局来决定当前控件的大小
wrap_content表示让当前的控件大小能够刚好包含里面的内容,也就是由控件内容决定当前控件的大小
fill_parent表示设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间。设置一个顶部布局或控件为fill_parent将强制性让它布满整个屏幕。
android:layout_below="@+id/user_input"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
layout_margin就是设置view的上下左右边框的额外空间
layout_marginTop表示距离顶端边框的空间
layout_marginLeft表示距离左端边框的空间
同理layout_marginRight、layout_marginBottom
本文概述安卓布局中常见的width属性设置,如match_parent、wrap_content和fill_parent的区别,以及layout_below、alignParentTop等布局定位方法。同时介绍layout_margin控制边距的方法。

被折叠的 条评论
为什么被折叠?



