zoukankan      html  css  js  c++  java
  • Android学习笔记——TableLayout

    该工程的功能是实现在一个activity中显示一个表格

    以下代码是MainActivity.java中的代码

    package com.example.tablelayout;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuItem;
    
    public class MainActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }
    }

    以下的代码是activity_main.xml中的代码

    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/TableLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:stretchColumns="1"
        tools:context="${relativePackage}.${activityClass}" >
        
        <!-- 由于fill_parent不能填满,所以stretchColumns指定列拉伸 -->
        
        <TableRow>
            <TextView
                android:text="@string/hello_world" 
                android:padding="3dip"
                android:background="#aa0000" />
            <TextView
                android:text="@string/hello_world" 
                android:padding="3dip"
                android:background="#00aa00"
                android:gravity="center_horizontal" />
            <TextView
                android:text="@string/hello_world" 
                android:padding="3dip"
                android:background="#0000aa"
                android:gravity="right" />
                         
        </TableRow>
            
        <TableRow>
            <TextView
                android:text="@string/hello_world" 
                android:padding="3dip" />
                 
            <TextView
                android:text="@string/hello_world" 
                android:padding="3dip"
                android:gravity="right" />
                       
        </TableRow>
    
    </TableLayout>
  • 相关阅读:
    navicat for mysql 10.1.7注册码
    去除GHOST版系统自带的2345流氓软件
    利用EXCEL表实现网页数据采集到MYSQL数据库
    Java开发的一个简单截屏工具
    初学JSP+Servlet常见的错误
    从零单排Linux – 3 – 目录结构
    从零单排Linux – 2 – 目录权限
    从零单排Linux – 1 – 简单命令
    在虚拟机中安装Linux
    随机生成MyEclipse注册码
  • 原文地址:https://www.cnblogs.com/tonglin0325/p/4584150.html
Copyright © 2011-2022 走看看