表格布局和线性布局

    XML: 一种是事件流(SAX)的解析和(DOM)文档解析。

  

        步骤:

  (1):在新建项目的res/layout下的项目目录布局文件 main.xml 中进行修改

  (2):表格布局管理器: <TableLayout

      其中为行的布局:    <TableRow

      基本格式:

        <TableLayout xmlns:android=http://schemas.android.com/apk/res/android

            属性列表

        >

        <TableRow 属性列表> 需要添加的UI组件 </TableRow>

          多个<TableRow>

        </TableLayout>

      

  (3):线性布局管理器: <LinearLayout

      线性布局是将放入其中的组件按照垂直或水平方向来布局。在线性布局中,每一行(针对垂直排序)或每一列(针对水平排序)

      中只能放一个组件,并且android中的线性布局不会换行,当到达窗体的边缘时,后面的组件就不再显示。

      其中排列方式由 android:orientation 属性来控制   对齐方式由 android:gravity 属性来控制

                基本格式: 

        <LinearLayout xmlns:android="http://schemas:android.com/apk/res/android"

          属性列表

          >

        </LinearLayout>

               其中添加文本组件: <TextView

       添加图像文本: <ImageView

  

  (4)  :帧布局管理器:   <FrameLayout

      <FrameLayout xmlns:android="http://schemas:android.com/apk/android"> 

        属性列表

      >

     </FrameLayout>

  (5)  :相对布局管理器: <RelativeLayout

    <RelativeLayout xmlns:android=http://schemas:android.com/apk/android>

      属性列表

    >

    </RelativeLayout>

  (6)  : 绝对布局管理器 :<AbsoluteLayout      //此种布局在2.0中已经不再用了。

     

原文地址:https://www.cnblogs.com/cliuwei/p/4681605.html