android:layout_alignParentRight

android:layout_alignParentRight="true" 
使当前控件的右端和父控件的右端对齐。这里属性值只能为true或false,默认false。 
android:layout_marginLeft="10dip" 
使当前控件左边空出相应的空间。 
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 // 
android:layout_centerInParent="true"//居中在父对象 
android:layout_centerInParent="false" ... 浏览器不支持多窗口显示,意思就是说所有页面在单一窗口打开,这样避免了页面布局控制显示问题 
下面的相对于父的相对位置 
*android:layout_alignParentBottom 
*android:layout_alignParentLeft 
*android:layout_alignParentRight 
*android:layout_alignParentTop 
*android:layout_alignWithParentIfMissing 
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这段代码定义了一个垂直排列的LinearLayout,其中包含一个RelativeLayout作为顶部栏,里面包括一个居中显示的TextView和一个右侧对齐的ImageView。 具体解释如下: - LinearLayout:定义了一个垂直排列的布局。 - android:orientation="vertical":设置LinearLayout的方向为垂直。 - android:layout_width="match_parent":设置LinearLayout的宽度为match_parent,即与父容器宽度相同。 - android:layout_height="match_parent":设置LinearLayout的高度为match_parent,即与父容器高度相同。 - RelativeLayout:定义了一个相对布局。 - android:layout_width="wrap_content":设置RelativeLayout的宽度为包裹内容。 - android:layout_height="48dp":设置RelativeLayout的高度为48dp。 - android:background="@android:color/holo_red_light":设置RelativeLayout的背景颜色为淡红色。 - TextView:定义了一个文本视图。 - android:layout_width="wrap_content":设置TextView的宽度为包裹内容。 - android:layout_height="wrap_content":设置TextView的高度为包裹内容。 - android:text="商品详情":设置TextView的文本内容为“商品详情”。 - android:textSize="24sp":设置TextView的文本大小为24sp。 - android:layout_centerVertical="true":设置TextView在垂直方向上居中对齐。 - android:layout_centerHorizontal="true":设置TextView在水平方向上居中对齐。 - ImageView:定义了一个图像视图。 - android:id="@+id/iv_me":为ImageView设置一个唯一的标识符,以便在代码中引用。 - android:layout_width="wrap_content":设置ImageView的宽度为包裹内容。 - android:layout_height="wrap_content":设置ImageView的高度为包裹内容。 - android:src="@mipmap/icon_shopping_car":设置ImageView的图像源为指定的图片资源。 - android:layout_alignParentRight="true":设置ImageView在父容器的右侧对齐。 - android:layout_centerVertical="true":设置ImageView在垂直方向上居中对齐。 - android:padding="12dp":设置ImageView的内边距为12dp。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值