zoukankan      html  css  js  c++  java
  • 界面排版-TableLayout的stretchColumns方法

    1.先把XML內的預設RelativeLayout排版方式清空,在去Layout區拉一個TableLayout的到表單上,XML下會出現下面程式碼
     
        <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:stretchColumns="2"
        >  (android:stretchColumns="2"是設定 TableLayout所有行的第二列是擴展列,列是指上下,行是左右,假設每行都有三列(三個物件),剩下空間會由第二列補齊,下面會做示範)
     
        </TableLayout>
     
    2.在Layout拉一個TableRow出來,在TableLayout標籤之間會夾著TableRow
     
        <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:stretchColumns="2"
        >
     
            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>
     
        </TableLayout>
     
     
    3.在去widget拉一個物件button出來,如圖片
    接下來再拉一個button
    OK,還是沒變化因為android:stretchColumns="2"是設定第二列才開始填滿,好!在拉一次button
    我們發現真的在第二列開始填滿剩下的空間了!也就是剩下空間會由第二列補齊(最左邊是第0列,以此類推)
  • 相关阅读:
    Java编译器API简介
    liblinear和libsvm区别
    spark和hadoop比较
    maxout激活函数
    FTRL算法
    NLP里面好的学习资料
    阿里妈妈MLR模型(论文)
    FM的推导原理--推荐系统
    GBDT+LR simple例子
    深度学习最全优化方法---来源于知乎
  • 原文地址:https://www.cnblogs.com/yxnchinahlj/p/4618636.html
Copyright © 2011-2022 走看看