Android 常用说明(国外英文资料)
Android 常用说明
1属性Android相对布局。
/ /相对于给定ID控件
安卓:layout_above将该控件的底部置于给定ID的控件之上;
安卓:layout_below将该控件的底部置于给定ID的控件之下;
安卓:layout_toleftof将该控件的右边缘与给定ID的控件左边缘对齐;
安卓:layout_torightof将该控件的左边缘与给定ID的控件右边缘对齐;
安卓:layout_alignbaseline将该控件的基线与给定ID的基线对齐;
安卓:layout_aligntop将该控件的顶部边缘与给定ID的顶部边缘对齐;
安卓:layout_alignbottom将该控件的底部边缘与给定ID的底部边缘对齐;
安卓:layout_alignleft将该控件的左边缘与给定ID的左边缘对齐;
安卓:layout_alignright将该控件的右边缘与给定ID的右边缘对齐;
/ /相对于父组件
安卓:layout_alignparenttop如果为真实,将该控件的顶部与其父控件的顶部对齐;
安卓:layout_alignparentbottom如果为真实,将该控件的底部与其父控件的底部对齐;
安卓:layout_alignparentleft如果为真实,将该控件的左部与其父控件的左部对齐;
安卓:layout_alignparentright如果为真实,将该控件的右部与其父控件的右部对齐;
/ /居中
安卓:layout_centerhorizontal如果为真实,将该控件的置于水平居中;
安卓:layout_centervertical如果为真实,将该控件的置于垂直居中;
安卓:layout_centerinparent如果为真实,将该控件的置于父控件的中央;
/ /指定移动像素
安卓:layout_margintop上偏移的值;
安卓:layout_marginbottom下偏移的值;
安卓:layout_marginleft左偏移的值;
安卓:layout_marginright右偏移的值;
例子:
安卓:layout_below =“@ ID / ***”
安卓:layout_alignbaseline =“@ ID / ***”
安卓:layout_alignparenttop =真
安卓:layout_marginleft =“10px”
2。一些常用的公共属性介绍
1)layout_width -宽
fill_parent:宽度和父元素相同,wrap_content:宽度随本身的内容所调整,或者指定PX值来设置宽
2)layout_height -高
fill_parent:高度和父元素相同,wrap_content:高度随本身的内容所调整,或者指定PX值来设置高
3)背景设置背景图
4)填料设置边距
You can set paddingBottom, paddingLeft, paddingRight, and paddingTop to set different PX values
5) id - the ID number of the object
@+id/id1 represents the addition of a new ID called Id1, and @id/id1 stands for reference Id1
6) layout_weight importance
The individual understands the priority of the display. The default is 0 (max). The larger the value, the lower the priority! Refer to the following example of Linear Layout. To make layout_weight work, you need the corresponding layout_width/layout_height = "fill_parent" of the parent or parent layer, otherwise wrap_content will be compressed to the minimum sufficient space!
7) alignment of layout_gravity- Container components
How is the component aligned in layout?.
8) the alignment of the gravity- text in the component
For example, set the text ins