_041_Android_Android常用布局

android:background="#000000" ; //设置背景

*android:layout_marginLeft =“xxxdp”;//设置左外边距

 android:layout_centerInParent="true"  --将控件置于父控件的中心位置
android:layout_centerHorizontal="true"  --将控件置于水平方向的中心位置
android:layout_centerVertical="true"  --将控件置于垂直方向的中心位置
 

相对布局:

(1) 

android:layout_alignParentRight="true" 
使当前控件的右端和父控件的右端对齐。这里属性值只能为true或false,默认false。 

  android:layout_toLeftOf="@id/ok" 
使当前控件置于id为ok的控件的左边。 


android:layout_alignTop="@id/ok" 
使当前控件与id控件的上端对齐。 


padding表示填充,margin表示边距 
可通过android:padding属性进行设置,4个方向的边距属性为android:paddingLeft, android:paddingRight, android:paddingTop, and android:paddingBottom. 


结论: 
*android:layout_marginBottom 
*android:layout_marginLeft 
*android:layout_marginRight 
*android:layout_marginTop 
上面几个属性的值是根据下面的相对位置的对象的值来做计算的,如果没有相对的对象就以总体布局来计算 
*android:layout_below 
*android:layout_above 
*android:layout_toLeftOf 
*android:layout_toRightOf 
*android:layout_alignTop 

*android:layout_centerHrizontal          //是否支持横屏或竖屏 
*android:layout_centerVertical             //这个根据单词的意思:处于垂直 方向的中心
android:layout_centerInParent="true"//居中在父对象 
android:layout_centerInParent="false" ... 浏览器不支持多窗口显示,意思就是说所有页面在单一窗口打开,这样避免了页面布局控制显示问题 
下面的相对于父的相对位置 
*android:layout_alignParentBottom 
*android:layout_alignParentLeft 
*android:layout_alignParentRight 
*android:layout_alignParentTop 
*android:layout_alignWithParentIfMissing 
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值