RelativeLayout用到的一些重要的屬性:
第一類:屬性值為true或false
android:layout_centerHrizontal 水平置中
android:layout_centerVertical 垂直置中
android:layout_centerInparent 相對於父元素完全置中
android:layout_alignParentBottom 貼緊父元素的下邊緣
android:layout_alignParentLeft 貼緊父元素的左邊緣
android:layout_alignParentRight 貼緊父元素的右邊緣
android:layout_alignParentTop 貼緊父元素的上邊緣
android:layout_alignWithParentIfMissing 如果對應的兄弟元素找不到的話就以父元素做參照物
第二類:屬性值必須為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 本元素的右邊緣和某元素的的右邊緣對齊
第三類:屬性值為具體的像素值,如30dip,40px
android:layout_marginBottom 離某元素底邊緣的距離
android:layout_marginLeft 離某元素左邊緣的距離
android:layout_marginRight 離某元素右邊緣的距離
android:layout_marginTop 離某元素上邊緣的距離
android:padding="15dip" padding是指內邊距(也就是指內容與邊框的距離),layout_margin為外邊距(它的上一層與邊框的距離)。
TextView
android:hint |
setHint(int) |
當TextView中顯示的內容為空白時,顯示該文本 |
android:typeface |
setTypeface(Typeface) |
設定TextView的文本字型 |
android:ellipsize |
setEllipsize(TextUtils.TruncateAt) |
若是設定了該屬性,當TextView中要顯示的內容跨越了TextView的長度時,會對內容進行省略。可取的值有start、middle、end和marquee |
EditText
android:shadowColor |
setShadowLayer(float,float,float,int) |
為文字框設定指定色彩的暗影 |
droid:shadowRadius |
setShadowLayer(float,float,float,int) |
為文字框設定暗影的半徑,為浮點數 |
android:singleLine |
setTransformationMethod(TransformationMethod) |
設定文字框的單行模式 |