Android總結二五大布局

來源:互聯網
上載者:User

標籤:android   c   a   line   表   table   

一、五大布局

  1、LinearLayout線性布局

  2、RelativeLayout相對布局

  3、AbsoluteLayout絕對布局

  4、TableLayout表格版面配置

  5、FrameLayout幀布局

二、LinearLayout線性布局

  1、android:orientation="horizontal"  制定線性布局的相片順序:水平 horizontal ,垂直 vertical   

  2、gravity 控制當前控制項內容顯示地區

    layout_gravity 當前控制項在父元素的位置

  3、Layout_weightSum

    Layout_weight 額外空間分配(權重)

  4、android:visibility="invisible"控制布局是否顯示

    1)顯示 visible

    2)不顯示,但占空間 invisible

    3)隱藏 gone

三、RelativeLayout 相對布局

  1、android:layout_toRightOf在指定控制項的右邊

  2、android:layout_above在指定控制項的上邊

  3、android:layout_alignBaseline跟指定控制項水平對齊

  4、android:layout_alignLeft跟指定控制項靠左對齊

  5、android:layout_alignParentLeft是否跟父布局靠左對齊

  6、android:layout_centerVertical在父布局中垂直置中

  7、android:layout_centerInParent在父布局中置中

四、AbsoluteLayout 絕對布局

  1、android:layout_x指定控制項在父布局的x軸座標

  2、android:layout_y指定控制項在父布局的y軸座標

五、FrameLayout 幀布局  

  幀布局每次添加的控制項都顯示在最上面,最後顯示在介面上的是最後添加的一個控制項

六、TableLayout 表格版面配置

  1、android:shrinkColumns收縮列

  2、android:stretchColumns展開列

  3、android:collapseColumns隱藏列

  4、android:layout_column指定列(作用在列的身上)

  5、android:layout_span合并列(作用在列的身上)

  TableRow單元行裡的儲存格的寬度小於預設的寬度時就不起作用,其預設是fill_parent,高度可以自訂大小

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.