gravity原意为地心引力、重力,在界面布局中表示摆放的位置。在开发中是离不开它的。具体内容查看android文档Gravity。
下面举个例子,我想把按钮放在中间,怎么做呢?
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
>
gravity的属性很多,基本可以满足我们界面布局的要求。