RelativeLayout布局

1.子View對象的屬性

第一類屬性 屬性值為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 //離某控件上邊緣的距離

參考文章

1.RelativeLayout屬性詳解

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容