android学习笔记(1) 布局文件

Junlei.Zhang posted @ Sep 24, 2012 11:26:20 AM in Android , 1029 readers

 

RelativeLayout常用属性总结:  

1.         属性值为truefalse

Ø         android:layout_centerHrizontal     水平居中

Ø         android:layout_centerVertical      垂直居中

Ø         android:layout_centerInparent     相对于父元素完全居中

Ø         android:layout_alignParentBottom  贴紧父元素的下边缘

Ø         android:layout_alignParentLeft    贴紧父元素的左边缘

Ø         android:layout_alignParentRight   贴紧父元素的右边缘

Ø         android:layout_alignParentTop     贴紧父元素的上边缘

 

2.         属性值必须为id的引用名“@id/id-name

Ø         android:layout_below          在某元素的下方

Ø         android:layout_above          在某元素的的上方

Ø         android:layout_toLeftOf        在某元素的左边

Ø         android:layout_toRightOf       在某元素的右边

Ø         android:layout_alignTop        本元素的上边缘和某元素的的上边缘对齐

Ø         android:layout_alignLeft        本元素的左边缘和某元素的的左边缘对齐

Ø         android:layout_alignBottom     本元素的下边缘和某元素的的下边缘对齐

Ø         android:layout_alignRight       本元素的右边缘和某元素的的右边缘对齐

   

3.         属性值为具体的像素值,如30dip40px

Ø         android:layout_marginBottom   离某元素底边缘的距离

Ø         android:layout_marginLeft      离某元素左边缘的距离

Ø         android:layout_marginRight     离某元素右边缘的距离

Ø         android:layout_marginTop      离某元素上边缘的距离

 

EditText常用属性总结:

Ø         android:hint 设置EditText为空时输入框内的提示信息。

Ø         android:gravity属性是对该view 内容的限定.比如一个button 上面的text.  你可以设置该textview的靠左,靠右等位置.以button为例,android:gravity="right"button上面的文字靠右

Ø         android:layout_gravity是用来设置该view相对与起父view 的位置.比如一个buttonlinearlayout里,你想把该button放在靠左、靠右等位置就可以通过该属性设置.以button为例,android:layout_gravity="right"button靠右

Ø         android:layout_alignParentRight

Ø         使当前控件的右端和父控件的右端对齐。这里属性值只能为truefalse,默认false

Ø         android:scaleType是控制图片如何resized/moved来匹对ImageViewsize

 


Avatar_small
25penny.com said:
Apr 16, 2023 05:58:56 PM

During your visit to our website, there are chances to collect more information without making you directly acknowledged. Website does collect your personal information such as name, identity, Gender and would also collect the geographic location. During your visit to our website, there are chances to collect more information without 25penny.com making you directly acknowledged. Website does collect your personal information such as name, identity, Gender and would also collect the geographic location.

Avatar_small
model-paper.com said:
Apr 16, 2023 06:03:39 PM

In certain cases your mail may be exposed to public that Modelpapers works on giving out better service in different forms and we do not sell or giveaway your personal information other than public info giving out by you. We are very conscious about mail spam model-paper.com and we try to protect every email as much as possible.


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter