TableLayout表格简单的使用

来源:互联网 发布:1701端口打不开 编辑:程序博客网 时间:2024/03/29 17:05

前言:对于安卓的学习,我也是半路出家的。接触安卓一年有余(实习生身份),在这期间,几乎不怎么写博客,当然也没有这爱好。来到企业,才发现,自己会的就像是大海的一滴水。有时候写一个布局,就要用去很多时间,顿时觉得自己的知识好匮乏,以前的学的也会忘很多,所以这更激起我写博客的决心了。第一次写博客,对于安卓的了解又是菜鸟一个,发表的知识望博客好友不要嘲笑哈微笑



            极其单间的一个布局:(先上图)

      


       <!-- 第一个表格 -->
         <TableLayout
             android:id="@+id/biaoge1"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">
             
             <TableRow
                 android:id="@+id/tr"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:orientation="horizontal"
                 android:gravity="center">
                  <TextView
                   android:id="@+id/tijiaozhuanchu_wm"
                   android:layout_width="0dp"
                   android:layout_weight="1"
                   android:layout_height="wrap_content"
                   android:text="提交转出申请"
                   android:gravity="center"
                   android:layout_marginTop="5dp"
                   android:layout_marginLeft="10dp"
                   android:layout_marginRight="10dp"
                   android:layout_marginBottom="5dp"
                   android:textSize="12sp"/>
                  
                <TextView
                   android:layout_width="0.5dp"
                   android:layout_height="match_parent"
                   android:background="@color/yellow_1"/>
                   
                <TextView
                   android:id="@+id/start_bank"
                   android:layout_width="0dp"
                   android:layout_weight="1"
                   android:layout_height="wrap_content"
                   android:text="开户银行"
                   android:gravity="center"
                   android:layout_marginTop="5dp"
                   android:layout_marginBottom="5dp"
                   android:textSize="12sp"/>
                     <TextView
                   android:layout_width="0.5dp"
                   android:layout_height="match_parent"
                   android:background="@color/yellow_1"/>
                     <TextView
                   android:id="@+id/to_accout_time"
                   android:layout_width="0dp"
                   android:layout_weight="1"
                   android:layout_height="wrap_content"
                   android:text="到账时间"
                   android:gravity="center"
                   android:layout_marginTop="16dp"
                   android:layout_marginBottom="16dp"
                   android:textSize="12sp"/>   
             </TableRow>  
         </TableLayout>

         对于第二个表格,只需复制第一个即可!!!

       1、     对于有两行文字的,只需输入\n 即可,  例如(上图所示): 周一至周四\n、周日

       2、          有大于符号的,需要用xml的转义符。XML只有5个转义符: &lt; &gt;&amp; &quot; &apos   分别是: <,>,&,",

                                        例如:2<金额<100 : 2&lt;金额&lt;100  。

         3、

                     


  


0 0