在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ Android/ 用 TableLayout 偽裝表格顯示數(shù)據(jù)
多分辨率適配常用目錄
Android 開發(fā)環(huán)境(Eclipse+ADT+Android 5.0)
Android 原型設(shè)計(jì)工具探索
Makefile 快速入門
Android Studio的NDK開發(fā)
人臉檢測-靜態(tài)
getprop 與 dumpsys 命令
Maven 編譯開源二維碼掃描項(xiàng)目 zxing
畫布 Canvas
組合控件
Linux 下的模擬器硬件加速
讀取 Excel
android.hardware.camera2 使用指南
橫豎屏切換
Ubuntu 下切換 JDK 版本
拍照和錄像 with Camera
文本與布局
按鈕控制 ViewPager 的左右翻頁
用 TableLayout 偽裝表格顯示數(shù)據(jù)
Preference Activity 使用詳解
模擬器如何重啟?試試 Genymotion!
獲得屏幕物理尺寸、密度及分辨率
語音識別
了解 native activity
Android Studio 導(dǎo)入第三方類庫、jar 包和 so 庫
啟動另一個(gè) App/apk 中的 Activity
APK 簽名
兩個(gè)開源的圖表/報(bào)表控件
android studio 導(dǎo)出 jar 包(Module)并獲得手機(jī)信息
圖片的 Base64 編解碼
混淆與反編譯
Android Studio 和 Gradle
Android 5.1 SDK 下載與配置
persistableMode 與 Activity 的持久化
adb 取出安裝在手機(jī)中的 apk
Android Studio 中的源代碼管理
Handler 使用中可能引發(fā)的內(nèi)存泄漏

用 TableLayout 偽裝表格顯示數(shù)據(jù)

先來上個(gè)圖,最終效果圖。

http://wiki.jikexueyuan.com/project/android-actual-combat-skills/images/34-1.png" alt="fig.1" />

每個(gè) Layout 都有自己最適用的場景,而 TableLayout 往往用在中規(guī)中矩的輸入界面,比如下圖:

http://wiki.jikexueyuan.com/project/android-actual-combat-skills/images/34-2.png" alt="fig.2" />

TableLayout 下嵌套 TableRow 組成 Table 的行;每個(gè) TableRow 中布局不同的控件,組成 Table 的列。上圖就是兩列四行,而我們要做的表格就是三行三列。

TableLayout 是沒有提供邊框的,要作成表格的效果需要我們使用一些技巧:

整個(gè) TableLayout 的背景色設(shè)成黑色,而每個(gè) Table 的 cell(其實(shí)就是每個(gè)控件)的背景色設(shè)成白色,然后 cell 的邊距根據(jù)情況設(shè)置一個(gè) px,就可以了。

布局代碼如下:

    <TableLayout
        android:id="@+id/table"
        android:layout_below="@id/spinner"
        android:layout_width="wrap_content"
        android:background="@color/black"
        android:layout_height="wrap_content">
        <TableRow
            android:layout_marginTop="1dp"
            android:layout_marginRight="1dp"
            android:layout_marginLeft="1dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <TextView android:text="姓名"
                android:textSize="@dimen/table_text_size"
                android:background="@color/white"
                android:layout_width="@dimen/table_item1_width"
                android:layout_height="wrap_content" />
            <TextView android:text="學(xué)校"
                android:textSize="@dimen/table_text_size"
                android:background="@color/white"
                android:layout_marginLeft="1dp"
                android:layout_width="@dimen/table_item2_width"
                android:layout_height="wrap_content" />
            <TextView android:text="專業(yè)"
                android:textSize="@dimen/table_text_size"
                android:background="@color/white"
                android:layout_marginLeft="1dp"
                android:layout_width="@dimen/table_item3_width"
                android:layout_height="wrap_content" />
        </TableRow>
        <TableRow
            android:layout_marginTop="1dp"
            android:layout_marginBottom="1dp"
            android:layout_marginRight="1dp"
            android:layout_marginLeft="1dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <TextView android:text="張飛"
                android:textSize="@dimen/table_text_size"
                android:background="@color/white"
                android:layout_width="@dimen/table_item1_width"
                android:layout_height="wrap_content" />
            <TextView android:text="野雞大學(xué)"
                android:textSize="@dimen/table_text_size"
                android:background="@color/white"
                android:layout_marginLeft="1dp"
                android:layout_width="@dimen/table_item2_width"
                android:layout_height="wrap_content" />
            <TextView android:text="體育系"
                android:textSize="@dimen/table_text_size"
                android:background="@color/white"
                android:layout_marginLeft="1dp"
                android:layout_width="@dimen/table_item3_width"
                android:layout_height="wrap_content" />
        </TableRow>
        <TableRow
            android:layout_marginBottom="1dp"
            android:layout_marginRight="1dp"
            android:layout_marginLeft="1dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <TextView android:text="劉備"
                android:textSize="@dimen/table_text_size"
                android:background="@color/white"
                android:layout_width="@dimen/table_item1_width"
                android:layout_height="wrap_content" />
            <TextView android:text="皇家學(xué)院"
                android:textSize="@dimen/table_text_size"
                android:background="@color/white"
                android:layout_marginLeft="1dp"
                android:layout_width="@dimen/table_item2_width"
                android:layout_height="wrap_content" />
            <TextView android:text="經(jīng)濟(jì)"
                android:textSize="@dimen/table_text_size"
                android:background="@color/white"
                android:layout_marginLeft="1dp"
                android:layout_width="@dimen/table_item3_width"
                android:layout_height="wrap_content" />
        </TableRow>
    </TableLayout>